Gamestudio Links
Zorro Links
Newest Posts
adviseLong returns 0 with custom Objective
by tomaslolo
Yesterday at 23:35
OptimalF factors for every step of WFO?
by AndrewAMD
Yesterday at 21:27
Is it possible to beat 50/50 with equal risk/reward?
by Nexow
Yesterday at 17:28
Help with Wine on Linux
by jcl
Yesterday at 11:28
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14
04/24/19 17:09
Stock Splits
by jcl
04/24/19 08:37
Thinking about Multiplayer
by kmega00
04/23/19 23:53
AUM Magazine
Latest Screens
The Space Between
Pogostuck: Rage With Your Friends
Worst Case Z
AckCon'18 - Lotter vs the World 2 - Preview Release
Who's Online
8 registered (AndrewAMD, ugofx, Zheka, tomaslolo, Ayumi, Uhrwerk, 2 invisible), 156 Guests and 6 Spiders online.
Key: Admin, Global Mod, Mod
Newest Members
zol, AlbertRUF, Zoltar, Bill_Lin_Fang, michaelj
18210 Registered Users
Topic Options
Rate This Topic
#474328 - 10/06/18 19:21 Delay Opening trades
MatPed Offline
User

Registered: 02/28/15
Posts: 547
Loc: Milano, Italy
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();
	
}


Top
#474331 - 10/07/18 08:27 Re: Delay Opening trades [Re: MatPed]
Spirit Offline
Moderator

Registered: 09/02/03
Posts: 823
You can see in the log if this works, but i think not, baroffset probably cannot change. How about Entrydelay?

Top
#474332 - 10/07/18 12:01 Re: Delay Opening trades [Re: Spirit]
MatPed Offline
User

Registered: 02/28/15
Posts: 547
Loc: Milano, Italy
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


Edited by MatPed (10/07/18 12:01)

Top
#474373 - 10/10/18 12:13 Re: Delay Opening trades [Re: MatPed]
MatPed Offline
User

Registered: 02/28/15
Posts: 547
Loc: Milano, Italy
Up

Top
#474384 - 10/11/18 08:35 Re: Delay Opening trades [Re: MatPed]
jcl Offline

Chief Engineer

Registered: 07/22/00
Posts: 26841
Loc: Frankfurt
It`s OrderDelay, not EntryDelay.

Top
#474389 - 10/11/18 10:09 Re: Delay Opening trades [Re: jcl]
MatPed Offline
User

Registered: 02/28/15
Posts: 547
Loc: Milano, Italy
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

Top
#474390 - 10/11/18 10:21 Re: Delay Opening trades [Re: MatPed]
jcl Offline

Chief Engineer

Registered: 07/22/00
Posts: 26841
Loc: Frankfurt
Yes, it is not recommended because it does not make much sense for saving trading costs, but technically you can do it.

Top
#474391 - 10/11/18 10:25 Re: Delay Opening trades [Re: jcl]
MatPed Offline
User

Registered: 02/28/15
Posts: 547
Loc: Milano, Italy
ok, thank you

Top



Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de