SetBreakEven worked in MC but didn't send order to Broker

Questions about MultiCharts and user contributed studies.
CAGMAD
Posts: 13
Joined: 04 May 2016

SetBreakEven worked in MC but didn't send order to Broker

Postby CAGMAD » 15 Feb 2018

I have a strategy on Gold futures that uses SetBreakEven and SetStopLoss. The SetBreakEven worked in the MC chart where I have the strategy but MC didn't send the BE stop loss order to the broker. Hoewever, I did get stopped out at a loss when the SetStopLoss order triggered. The result is that I have a trade with a breakeven P&L in MC but a trade that is a loss at my broker (InteractiveBrokers).

Any idea why this happened?

Regards
Cagmad

User avatar
TJ
Posts: 6837
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 979 times
Been thanked: 1968 times

Re: SetBreakEven worked in MC but didn't send order to Broker

Postby TJ » 15 Feb 2018

CAGMAD wrote:I have a strategy on Gold futures that uses SetBreakEven and SetStopLoss. The SetBreakEven worked in the MC chart where I have the strategy but MC didn't send the BE stop loss order to the broker. Hoewever, I did get stopped out at a loss when the SetStopLoss order triggered. The result is that I have a trade with a breakeven P&L in MC but a trade that is a loss at my broker (InteractiveBrokers).

Any idea why this happened?

Regards
Cagmad



Can't tell you much without seeing the codes.

CAGMAD
Posts: 13
Joined: 04 May 2016

Re: SetBreakEven worked in MC but didn't send order to Broker

Postby CAGMAD » 15 Feb 2018

Inputs MyStop, MyBreakEven and MyProfit are all >0. The SL worked (sent instruction to broker) but not the BE. At the very end of the strategy code, I have the SL, BE and PT instructions.

Code: Select all

setstopcontract;
If MyStop > 0 then setstoploss(MyStop*bigpointvalue);
If MyBreakEven > 0 then setbreakeven(MyBreakEven*bigpointvalue);
If MyProfit > 0 then setprofittarget(MyProfit*bigpointvalue);

User avatar
TJ
Posts: 6837
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 979 times
Been thanked: 1968 times

Re: SetBreakEven worked in MC but didn't send order to Broker

Postby TJ » 15 Feb 2018

CAGMAD wrote:Inputs MyStop, MyBreakEven and MyProfit are all >0. The SL worked (sent instruction to broker) but not the BE. At the very end of the strategy code, I have the SL, BE and PT instructions.

Code: Select all

setstopcontract;
If MyStop > 0 then setstoploss(MyStop*bigpointvalue);
If MyBreakEven > 0 then setbreakeven(MyBreakEven*bigpointvalue);
If MyProfit > 0 then setprofittarget(MyProfit*bigpointvalue);



See post #5
viewtopic.php?t=10811

CAGMAD
Posts: 13
Joined: 04 May 2016

Re: SetBreakEven worked in MC but didn't send order to Broker

Postby CAGMAD » 15 Feb 2018

Post #5 says that the problem may have been caused by placing global exits inside a condition. I use setstoploss and setprofit targets inside conditions with other strategies and I haven't had any problems in the past. This is the first time, though, that I use setbreakeven in addition to the other two.
I will make changes so there is no conditional and see whether that solves the issue.

Thanks and regards
Cagmad


Return to “MultiCharts”