Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, RealSerious3D, chsmac85), 980 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 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: 586
Austria
Petra Offline
Support
Petra  Offline
Support

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


Moderated by  Petra 

Gamestudio download | chip programmers | 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