Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
4 registered members (fogman, Grant, AndrewAMD, juanex), 989 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 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: 581
Austria
Petra Offline
Support
Petra  Offline
Support

Joined: Apr 2008
Posts: 581
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