Gamestudio Links
Zorro Links
Newest Posts
nba2king Latest Roster Update Breakdown
by joenxxx. 10/14/25 06:06
Help!
by VoroneTZ. 10/14/25 05:04
Zorro 2.70
by jcl. 10/13/25 09:01
ZorroGPT
by TipmyPip. 10/12/25 13:58
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 10/11/25 18:45
Reality Check results on my strategy
by dBc. 10/11/25 06:15
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
2 registered members (Grant, joenxxx), 9,921 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
joenxxx, Jota, krishna, DrissB, James168
19170 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: 242
L
Lapsa Offline
Member
Lapsa  Offline
Member
L

Joined: Aug 2021
Posts: 242
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: 242
L
Lapsa Offline
Member
Lapsa  Offline
Member
L

Joined: Aug 2021
Posts: 242
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