Suspend Trading for the day after 2 consecutive losses

Questions about MultiCharts and user contributed studies.
LMC1
Posts: 50
Joined: 28 Apr 2013
Has thanked: 29 times
Been thanked: 1 time

Suspend Trading for the day after 2 consecutive losses

Postby LMC1 » 28 Apr 2013

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

User avatar
ABC
Posts: 718
Joined: 16 Dec 2006
Location: www.abctradinggroup.com
Has thanked: 125 times
Been thanked: 408 times
Contact:

Re: Suspend Trading for the day after 2 consecutive losses

Postby ABC » 28 Apr 2013

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

LMC1
Posts: 50
Joined: 28 Apr 2013
Has thanked: 29 times
Been thanked: 1 time

Re: Suspend Trading for the day after 2 consecutive losses

Postby LMC1 » 30 Apr 2013

Thanks, I'll try again.

LMC


Return to “MultiCharts”