Delay Opening trades

Posted By: MatPed

Delay Opening trades - 10/06/18 17:21

If I want to randomly open trades from 1 to 5 minute later than bar closing period (as z7) with Hedge active how can I do?

May I change BarOffset during trading?

This script works in test, I do not logically correct.
Changing BarOffset every bar am I loosing price info in the bar?

Thank You

Code:
void run()
{
	set(LOGFILE); 	
	MaxLong	= 100;
	MaxShort	= 1;
	
	BarPeriod =60;
	
	if (TrainMode) BarOffset = 0;
	else BarOffset = random(6);
	
	enterLong();
	
}

Posted By: Spirit

Re: Delay Opening trades - 10/07/18 06:27

You can see in the log if this works, but i think not, baroffset probably cannot change. How about Entrydelay?
Posted By: MatPed

Re: Delay Opening trades - 10/07/18 10:01

Thank You Spirit, in the log it works, but is not logically sound.

EntryDelay seems to be a suitable solution but is not compatible with Hedge = 5, accordingly with the Manual.

In z7 Hedge is not used and the delay is fixed for each bar.
I could test it live, but it will take a lot of time. Maybe somebody as already a solution
Posted By: MatPed

Re: Delay Opening trades - 10/10/18 10:13

Up
Posted By: jcl

Re: Delay Opening trades - 10/11/18 06:35

It`s OrderDelay, not EntryDelay.
Posted By: MatPed

Re: Delay Opening trades - 10/11/18 08:09

Thank you JCL
The manual state "OrderDelay is not recommended in combination with Virtual Hedging. As it opens and closes trades not at bar boundaries, it can cause trades to be opened and closed shortly afterwards by another trade in opposite direction after the given delay. This causes loss of spread and commission."

2 questions:
- It si not recomended for loss in commission?, but it works?
- There is another method? more compatible with VH?

Thank you
Posted By: jcl

Re: Delay Opening trades - 10/11/18 08:21

Yes, it is not recommended because it does not make much sense for saving trading costs, but technically you can do it.
Posted By: MatPed

Re: Delay Opening trades - 10/11/18 08:25

ok, thank you
© 2024 lite-C Forums