Automatisc order execution

Questions about MultiCharts and user contributed studies.
Erik Pepping
Posts: 74
Joined: 25 Aug 2007
Been thanked: 6 times

Automatisc order execution

Postby Erik Pepping » 28 Apr 2009

How can i start with the automatic order execution. I just have started my system, but multicharts is in the middle of a trade. I do not want to jump in, nor do I want the first Sell Stop or Stop profit to take a position in interactive brokers, which will happen. Is there a possibility to skip the first trade ?

Please advise

SUPER
Posts: 646
Joined: 03 Mar 2007
Has thanked: 106 times
Been thanked: 84 times

Postby SUPER » 28 Apr 2009

If you start in SYNC mode then the system will take trade as they
develop so you will not have any mismatch of trades between your broker and chart.

You can wait for your chart to enter first trade then start automation and hopfully depending on your system logic you would avoid the first trade.

I suggest you first run your automation on a Simulated Account to gain more experince and confidence.

Good Luck with your first automated trade.

Erik Pepping
Posts: 74
Joined: 25 Aug 2007
Been thanked: 6 times

Postby Erik Pepping » 28 Apr 2009

Actually sync mode is wrong. Because the position of the chart does not concur with the position at the broker when you start.
My system only trades once or twice a day. I start multicharts. My broker position is flat. Multicharts position is short, because i just start.

I do not want to go short, since I mised most of the trade. When the code says Sell to get out of my long trade multicharts will be flat, but I will be short.

I rather have an option in automatic order execution skip next trade.

SUPER
Posts: 646
Joined: 03 Mar 2007
Has thanked: 106 times
Been thanked: 84 times

Postby SUPER » 28 Apr 2009

Actually sync mode is wrong. Because the position of the chart does not concur with the position at the broker when you start.
My system only trades once or twice a day. I start multicharts. My broker position is flat. Multicharts position is short, because i just start.

I do not want to go short, since I mised most of the trade. When the code says Sell to get out of my long trade multicharts will be flat, but I will be short.

I rather have an option in automatic order execution skip next trade.

Sync Mode:

When you start the system in Sync mode it takes market position as "0" zero and your chart will be blank without any trades shown on it. As soon as a new trade is generated and gets filled at the broker end it will appear on the chart and that will be your first visible trade on chart. In short it will not not interfere with your short position as it does not show any historical trades on chart.

Async Mode:

In Async Mode you have option to decide on market position at broker, long, short or flat this option allows you to remain in sync with your chart as Historical trades are displayed on chart.

You can start in ASYNC mode and select option " Assume the initial market position at the broker FLAT" and autotrade will not interfere with your existing position.

I really think you should first run your system on a "IB's Simulated" Account to fully understand the MC's autotrading aspects.

After many months of trying out MC's AutoEngine I can say that it works as expected.
Last edited by SUPER on 28 Apr 2009, edited 2 times in total.

brodnicki steven
Posts: 407
Joined: 01 Jan 2008
Been thanked: 3 times

Postby brodnicki steven » 28 Apr 2009

I would either close out the current trade in Multicharts(using date and time of current trade to exit), or wait until your system is flat, then start in sync mode.

Erik Pepping
Posts: 74
Joined: 25 Aug 2007
Been thanked: 6 times

Postby Erik Pepping » 28 Apr 2009

How do I close out the current trade in Multicharts.?

I don't think you guys understand my problem. The problem is that multicharts will send the upcoming trade to IB, if the arrows are visible or not.

Since the next trade is a stop loss it will send a buy signal to IB. But i am flat at IB, which means I will go long, but the correct position according to the system is Flat.

I used to have an external program that picks up a file that was written to disk. It had the option to skip the next trade with a check box in the main screen This was a simple method but always worked fine to align the program with what I wanted, and thus after the first trade aligned the system with the broker.

By the way I am using it on a simulated account at IB,

brendanh
Posts: 158
Joined: 07 Apr 2007
Has thanked: 1 time

Postby brendanh » 28 Apr 2009

Hi Erik,

You said
The problem is that multicharts will send the upcoming trade to IB, if the arrows are visible or not. Since the next trade is a stop loss it will send a buy signal to IB.
This is not the case in sync mode. In sync mode, Multicharts assumes your market position is zero when you enable autotrading, thus if the first trade is an exit, it will not be placed. Super is correct, however perhaps would have been better to say "As soon as a new [entry] trade is generated and gets filled at the broker end it will appear on the chart and that will be your first visible trade on chart."

That is my understanding of how it works anyway. Sync mode carries its own problems though, such as if you have to re-enable autotrading while in a trade, it won't place the exit. This is why I use Async with the "Assume the initial market position at the broker is the SAME AS on the chart" option.
Last edited by brendanh on 28 Apr 2009, edited 1 time in total.

SUPER
Posts: 646
Joined: 03 Mar 2007
Has thanked: 106 times
Been thanked: 84 times

Postby SUPER » 28 Apr 2009

How do I close out the current trade in Multicharts.?

No idea, what do mean by above statement-explain.

*if you choose an option "Require order confirmation " you have possibility to ignore any order that you may choose.
I don't think you guys understand my problem. The problem is that multicharts will send the upcoming trade to IB, if the arrows are visible or not.

Since the next trade is a stop loss it will send a buy signal to IB. But i am flat at IB, which means I will go long, but the correct position according to the system is Flat.
If you have a short trade on your chart (as you describe) and start automation in Sync mode I can bet you that Multichart will not send a Buy Stop loss order for your historical short order, because when you start in Sync mode there is no history of your short trade.

I don't think I can add anything more than this simple explanation.

Erik Pepping
Posts: 74
Joined: 25 Aug 2007
Been thanked: 6 times

Postby Erik Pepping » 29 Apr 2009

OK, I think Then it is probablty my coding experience. When I'm coding for a Buy stop I just code a Sell ? Is that wrong ? How Do I code a Stop Loss or Take profit correctly in Easylanguge.?

Now I have something like :
if Close < Stoploss then
begin
Sell ("StopLoss") this bar ;
end

SUPER
Posts: 646
Joined: 03 Mar 2007
Has thanked: 106 times
Been thanked: 84 times

Postby SUPER » 29 Apr 2009

finally, we understand that it is coding issue.

Use built in functions:

SetStopLoss (Amount);
SetProfitTarget(Amount);

or

Check for MarketPosition in your code

Now I have something like :
if MarketPosition=1 and Close < Stoploss then
begin
Sell ("StopLoss") this bar ;
end

User avatar
Marina Pashkova
Posts: 2758
Joined: 27 Jul 2007

Postby Marina Pashkova » 29 Apr 2009

Actually sync mode is wrong. Because the position of the chart does not concur with the position at the broker when you start.
My system only trades once or twice a day. I start multicharts. My broker position is flat. Multicharts position is short, because i just start.

I do not want to go short, since I mised most of the trade. When the code says Sell to get out of my long trade multicharts will be flat, but I will be short.

I rather have an option in automatic order execution skip next trade.
Hi Erik and everybody,

I am afraid the above is quite an understandable misconception of how the synchronous auto trading works. Just to clarify things once again (some of you were quite close to how this mode works):

The synchronous mode ensures that the market position on the chart is the same as that at the broker. The moment you enable the synchronous auto trading mode, all the signals calculated previously on history are deleted; the market position on the chart and at the auto trading engine becomes = 0 and the strategy starts afresh from the moment auto trading is enabled. Thus you start trading with the market position =0 both in MultiCharts and at the broker.


If, for whatever reason, you want to use the asynchronous mode, then with the help of a simple code posted here you can bring the position on the chart to zero by the time you start auto trading.

Also, as suggested above you can use the 'Assume market possiton at the broker...' option to make sure the positions at the broker and on the chart match.
Attachments
AT_Initializer.zip
(861 Bytes) Downloaded 130 times


Return to “MultiCharts”