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
Suspend Trading for the day after 2 consecutive losses
- ABC
- Posts: 731
- Joined: Dec 16 2006
- Location: www.abctradinggroup.com
- Has thanked: 126 times
- Been thanked: 415 times
- Contact:
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:
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
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;
Regards,
ABC