Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by opm. 10/24/25 03:44
ZorroGPT
by TipmyPip. 10/23/25 21:05
Alpaca Plugin v1.4.0
by TipmyPip. 10/20/25 18:04
stooq.pl quotes help
by gbe. 10/19/25 21:08
What are you working on?
by rayp. 10/15/25 20:44
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
2 registered members (vestria, Nymphodora), 4,230 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Blueguy, blobplayintennis, someone2, NotEBspark, vestria
19176 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