Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
4 registered members (TipmyPip, AndrewAMD, dBc, clonman), 18,621 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Limiting Trades Per Day #417155
02/09/13 11:44
02/09/13 11:44
Joined: Sep 2012
Posts: 99
T
TankWolf Offline OP
Junior Member
TankWolf  Offline OP
Junior Member
T

Joined: Sep 2012
Posts: 99
Im wondering if someone might be able to help me out with a problem I cant seem to solve. In one of my scripts I want to limit the amount of trades per day. What Im trying to achieve is to only allow one long trade and one short trade per day if certain entry requirements occur. I can obviously restrict opening trades by using NumOpenLong & NumOpenShort but this doesnt achieve what I desire Im not sure how I only allow one trade in both directions to be triggered each day.

I was thinking it would work something like this but doesnt seem to work as I wanted:

Quote:

static int ShortTradesPerDay = 0;
static int LongTradesPerDay = 0;
if(day(0) != day(1)) { //New Day
ShortTradesPerDay = 1; //Reset ShortTrades allowed back to 1 at new day?
LongTradesPerDay = 1; //Reset LongTrades allowed back to 1 at new day?
}
if(Condition A > Condition B && LongTradesPerDay == 1) {
enterLong();
LongTradesPerDay -= 1;
}
else if(Condition B > Condition A && ShortTradesPerDay == 1) {
enterShort();
ShortTradesPerDay -=1;

Re: Limiting Trades Per Day [Re: TankWolf] #417175
02/09/13 17:02
02/09/13 17:02
Joined: Apr 2008
Posts: 594
Austria
Petra Offline
Support
Petra  Offline
Support

Joined: Apr 2008
Posts: 594
Austria
I would also do it this way, what does not work?


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