Limiting Trades Per Day

Posted By: TankWolf

Limiting Trades Per Day - 02/09/13 11:44

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;
Posted By: Petra

Re: Limiting Trades Per Day - 02/09/13 17:02

I would also do it this way, what does not work?
© 2024 lite-C Forums