Restart auto-trading system without modifying the position

Questions about MultiCharts and user contributed studies.
arjfca
Posts: 1273
Joined: 23 Nov 2010
Has thanked: 721 times
Been thanked: 222 times

Restart auto-trading system without modifying the position

Postby arjfca » 25 Jan 2011

Hello
A newby interogation
I'm on paper trading with IB so no arm for my problem.

Twice, I did restart my auto-trading signal while I had position on IB account. While after restarting it, the actual position as been closed and a new position as been entered.

These modifications where not planned and did not respect my backtest rules. For sure it is not Multicharts to blame, but me.

How do I restart without modifying the position nor the stop loss attached to it.

Martin

User avatar
Dave Masalov
Posts: 1712
Joined: 16 Apr 2010
Has thanked: 51 times
Been thanked: 485 times

Re: Restart auto-trading system without modifying the positi

Postby Dave Masalov » 26 Jan 2011

Dear Martin,

Could you please explain the situation in details? What do you mean by restart? Normally, if you turn off the signal or auto trading, you should see a dialogue asking you whether you want to close open positions or cancel the orders.

arjfca
Posts: 1273
Joined: 23 Nov 2010
Has thanked: 721 times
Been thanked: 222 times

Re: Restart auto-trading system without modifying the positi

Postby arjfca » 26 Jan 2011

Hello Dave

I think that i have resolve the problem, but has not tested yet. In my coding, I was looking and modifying in a loop the stop level. Code was not looking for an open position and just send order to the market. When i restarted the Signal, Stop loss on open positions was issued, even if no positions where active.

Now , I added a line to look for a position before sending a new stopp order value. This should resolve the problem.

Code: Select all

If MyPosition = 1 then Sell next bar at StopValueLP stop;  // This will issue a new stop target for a long position
If MyPosition = -1 then buytocover Next Bar At StopValueSP Stop; // This will issue a new stop target for a short  position

I still have some interogation on how to restart the Signal when a position is in place. I will practice this morning.

Martin

User avatar
Dave Masalov
Posts: 1712
Joined: 16 Apr 2010
Has thanked: 51 times
Been thanked: 485 times

Re: Restart auto-trading system without modifying the positi

Postby Dave Masalov » 26 Jan 2011

Dear Martin,

What auto trading mode do you use? In synchronous mode, initially the position will be flat. In asynchronous mode, if you do not specify the position it will be flat too (for this strategy only, not the real position at broker).

arjfca
Posts: 1273
Joined: 23 Nov 2010
Has thanked: 721 times
Been thanked: 222 times

Re: Restart auto-trading system without modifying the positi

Postby arjfca » 26 Jan 2011

Hello Dave

I use the synchronous mode. Flat mode is assume, but when i had an active position, I dont fully understand how to set it.
Will see how it goes. Practice and knowledge will get me on the track

Martin

User avatar
Dave Masalov
Posts: 1712
Joined: 16 Apr 2010
Has thanked: 51 times
Been thanked: 485 times

Re: Restart auto-trading system without modifying the positi

Postby Dave Masalov » 27 Jan 2011

Dear Martin,

If you want to be able to specify the position that you are in when turning on auto trading, you need to use asynchronous mode. It is not possible in SA mode.

arjfca
Posts: 1273
Joined: 23 Nov 2010
Has thanked: 721 times
Been thanked: 222 times

Re: Restart auto-trading system without modifying the positi

Postby arjfca » 27 Jan 2011

I see :).
That is answering my questioning about the mismatch position.

Since I need to have the "Synch mode", I then need to close the position or manually follow it before starting the signal. Only start autotrading when position is flat on both side.

Autofilled account position could be another request feature, or, is it already planned in next version?

Martin

User avatar
Dave Masalov
Posts: 1712
Joined: 16 Apr 2010
Has thanked: 51 times
Been thanked: 485 times

Re: Restart auto-trading system without modifying the positi

Postby Dave Masalov » 27 Jan 2011

Dear Martin,

Not sure what do you mean by Autofilled account position. Could you please explain?

arjfca
Posts: 1273
Joined: 23 Nov 2010
Has thanked: 721 times
Been thanked: 222 times

Re: Restart auto-trading system without modifying the positi

Postby arjfca » 27 Jan 2011

Multicharts to look on broker account and retrieve the information about the
Instrument, quantity, actual stop attached to it or a reverse stop position etc.

MC could then display the page about the actual account position and the user approve then by selecting OK. MC Ask some question about the stategy name or other question to replace the account position in the same context as the signal would had done it

These positions are then installed in MC database and the follow-up or process of it, done like if these positions where created by MC

This way, MC will be in-synch with broker account with a minimum intervention by the user.

Hope I'm clear ennough. If not, I will rephrase it. :)

Martin

User avatar
Dave Masalov
Posts: 1712
Joined: 16 Apr 2010
Has thanked: 51 times
Been thanked: 485 times

Re: Restart auto-trading system without modifying the positi

Postby Dave Masalov » 28 Jan 2011

Dear Martin,

I apologize for misinformation. MC 6 does allow you to set the position that you are in when turning on the SA mode. All you need to do is check "Show always" in Strategy Properties --> Auto Trading --> Assign the Initial Market Position at the Broker Settings --> Show... Again, sorry for confusion.


Return to “MultiCharts”