Page 1 of 1

Suspend Trading for the day after 2 consecutive losses

Posted: Apr 28 2013
by LMC1
Hi,

I want to include codes into my strategy to perform the captioned action, such that after 2 consecutive losses there will be no further trades for the remaining time of the same day.

Can anyone help ?
Thanks.

LMC

Re: Suspend Trading for the day after 2 consecutive losses

Posted: Apr 28 2013
by ABC
Hi LMC,

in my opinion you can use the two reserved words PosTradeProfit and PosTradeEntryDateTime to accomplish that. You can check if the trade was done today and entered with a profit or loss.
Depending on your trade length you might want to use PosTradeExitDateTime, in case you are not only daytrading.
With these reserved words you can detect if the last two trades have been losers and in that case you activate a true/false switch that will block new trades. On a date change you simply reset the switch, so it would look something like this:

Code: Select all

if Date <> Date[1] then NewTradesAllowed = true; //NewTradesAllowed would be the switch here

//then the part were you check for the outcome of the last two trades
//you can actually only check for the most recent one and use a counter that
//you increment in case this trade was a loss and reset if it was a winner

if two consecutive losing trades detected then
NewTradesAllowed = false;


if NewTradesAllowed then
begin

//your entries should be in here

end;
This should get you going. In case you have any questions, post them with the code you have done so far and I am sure we can point you in the right direction.

Regards,
ABC

Re: Suspend Trading for the day after 2 consecutive losses

Posted: Apr 30 2013
by LMC1
Thanks, I'll try again.

LMC