Gamestudio Links
Zorro Links
Newest Posts
Issues resuming trades on Demo account
by Martin_HH. 05/21/26 17:41
XTB
by pr0logic. 05/18/26 12:27
ZorroGPT
by TipmyPip. 05/17/26 12:08
Purchase A8 full licence version
by NeoDumont. 05/13/26 20:17
Black Book, 4th edition
by TipmyPip. 05/11/26 08:40
No errors in the command line
by jcl. 05/08/26 10:59
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
4 registered members (Quad, ozgur, Martin_HH, BrainSailor), 19,529 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Koti, curry, DeepxKalsi, Samed, ukgamer
19217 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Maximum of One Trade per Minute #483951
08/17/21 21:00
08/17/21 21:00
Joined: Aug 2018
Posts: 101
O
OptimusPrime Offline OP
Member
OptimusPrime  Offline OP
Member
O

Joined: Aug 2018
Posts: 101
Hi Team:

I am exploring various timing algorithms to use within a script. I can't figure out how to allow no more than one trade within a one-minute period. This one-minute rule is to apply, regardless of all other periodicity, trade direction, Timeframes, BarPeriods, etc. It's like a stand-alone timer that makes sure we never enter more than one trade within a minute.

Do you have any suggestions on how I might accomplish this?

Thanks so much


Thanks so much,

OptimusPrime

Re: Maximum of One Trade per Minute [Re: OptimusPrime] #483952
08/17/21 21:20
08/17/21 21:20
Joined: Aug 2021
Posts: 243
L
Lapsa Offline
Member
Lapsa  Offline
Member
L

Joined: Aug 2021
Posts: 243
It's possible to restrict total amount of trades per side.

Code
MaxLong = 5;
MaxShort = 5;


But that's not exactly the same as 1 per minute.

One approach might be to store the value of minute(0) and then check up that minute(0) != stored_minute if (NumOpenLong || NumOpenShort) > 0.

Re: Maximum of One Trade per Minute [Re: OptimusPrime] #483953
08/17/21 21:59
08/17/21 21:59
Joined: Aug 2021
Posts: 243
L
Lapsa Offline
Member
Lapsa  Offline
Member
L

Joined: Aug 2021
Posts: 243
It's sort of dumb approach.


Using hours as I lack tick data.

Code
#include <profile.c>

var storedHour = .0;

function run()
{
	set(PLOTNOW);
	BarPeriod = 1;
	LookBack = 100;
	StartDate = 20210715;
	EndDate = 20210816;

	var currentHour = hour(0);
        // var currentMinute = minute(0);
	
	bool goLong = random() > 0;
	bool goShort = !goLong;
			
	bool sureWhyNot =
		(NumOpenLong + NumOpenShort) <= 0 ||
		currentHour != storedHour;
	
	if (goLong && sureWhyNot) {
		enterLong();
		storedHour = currentHour;
	}		
	
	if (goShort && sureWhyNot) {
		enterShort();
		storedHour = currentHour;
	}
}


[Linked Image]


To be fair - I would question necessity for such feature.

Re: Maximum of One Trade per Minute [Re: OptimusPrime] #483954
08/18/21 03:20
08/18/21 03:20
Joined: Aug 2018
Posts: 101
O
OptimusPrime Offline OP
Member
OptimusPrime  Offline OP
Member
O

Joined: Aug 2018
Posts: 101
Hi Lapsa: Thanks for your response. I found minute() in the manual and I am testing it as follows. https://zorro-trader.com/manual/en/month.htm

if(minute() != StoredMinute)
TradeAllowed = true;

Appreciated !


Thanks so much,

OptimusPrime


Moderated by  Petra 

Gamestudio download | Zorro platform | shop | Data Protection Policy

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

Powered by UBB.threads™ PHP Forum Software 7.7.1