Auto Trading Strategy did not reverse position

Questions about MultiCharts and user contributed studies.
User avatar
Xurma
Posts: 31
Joined: 24 Nov 2020
Has thanked: 9 times

Auto Trading Strategy did not reverse position

Postby Xurma » 02 Nov 2021

Hello.
I run my strategy. First enter was good, but then strategy did not reverse position to another side, today, when condition was for it.
Yestarday IBGateway shutdown in specific time, then I run it again and setup it to restart every day at specific time against shutting down. IBGateway should been restarted every day and no other option? I need it just work 24/7.
My position still in long and did not reverse to short side, even when condition is done. Why it can happens?
Backtest is ok, every enter is done, this issue only in AutoTrading mode.

PS. I replace MarketPosition to MarketPosition_at_Broker, I think problem was there.

User avatar
Kate MultiCharts
Posts: 591
Joined: 21 Oct 2020
Has thanked: 9 times
Been thanked: 148 times

Re: Auto Trading Strategy did not reverse position

Postby Kate MultiCharts » 03 Nov 2021

Hello,

Please use the Print keyword to make sure your position reverse condition is met in real-time.
A general example is available in our Wiki.

As for the IB Gateway autorestart, in MC you can set a period of time after which the broker profile is disconnected in case of connection losses or deactivate this setting.
More info about it here.

User avatar
syswizard
Posts: 295
Joined: 15 Dec 2012
Has thanked: 16 times
Been thanked: 28 times

Re: Auto Trading Strategy did not reverse position

Postby syswizard » 03 Nov 2021

PS. I replace MarketPosition to MarketPosition_at_Broker, I think problem was there.
Do you have to use MarketPosition for backtesting and MarketPosition_at_Broker for autotrading in realtime ?

User avatar
Xurma
Posts: 31
Joined: 24 Nov 2020
Has thanked: 9 times

Re: Auto Trading Strategy did not reverse position

Postby Xurma » 05 Nov 2021

Thank you for answers. I still had issues with real trading.
1. I replaces MarketPosition function to MarketPosition_at_Broker for real trading and I saw that is signal worked incorrect. How to correctly determinate Market Position in real trading?
2. IBGateway restarts every day and every time it lost connection with Historical Data Base after restarting and it cannot reconnect by itself. Yesterday it lost connection in the middle of the day and still not updates. Other connection is good, only 1 red line in IBGATEWAY with Historical Data Base.


Return to “MultiCharts”