Intrabar order generation, marketposition and multi entries

Questions about MultiCharts and user contributed studies.
Darkomage
Posts: 8
Joined: 06 Dec 2007
Been thanked: 1 time

Intrabar order generation, marketposition and multi entries

Postby Darkomage » 24 Feb 2009

Hi,

I'm wondering is MC adjusts the marketposition value when genrating intrabar orders in auto trading mode, or only at the end of the bar.

Is there a way to ask a signal to be able to fire the orders multiple times, but only when no position is taken when it should fire up. I mean this:
-I have a long buy order at price x.
-Once it's sent, I use setstoploss function to place a stoploss order.
-how can I ask MC to send the buy order multiple times wihtin a bar, but only if the previous long position was closed (either by the stoploss function, or by the proftitarget function) ?

The idea is to allow multiple entries, but not to end up with a huge positio nmade up of multiple unclosed entries (which would eat all my buying power and make a margin call occure...)

ATM, I use something like that:

Code: Select all

setstopposition;
if stoploss<>0 then setstoploss(stoploss*lots) else setstoploss(99999999);
if profit<>0 then setprofittarget(profit*lots) else setprofittarget(99999999);

if marketposition<=0 and close<prixce_to_get_long then buy lots*10000 contracts next bar at prixce_to_get_long stop;
if marketposition>=0 and close>price_to_get_short then sellshort lots*10000 contracts next bar at price_to_get_short stop;
(with intrabarordergeneration turned on, with radio button 'allow unlimited entries/exits in bar' checked)...

But what happens is that if one order is sent and executed, say the buy one, I get a buy arrow with - say - 20 000 contracts shown on it. But when the stoploss or tarrget is reached, the exit arrow show 0 contracts. And I believe market position does not adjust, so the strategy can only enter in the opposite side, and cannot launch the order again if the price gets below the long thresold price and then up again...

Thanks to anyone who can help me with this one... (A quite profitable system on Forex I would be able to post in the forum once those "little problems" are solved !)

Return to “MultiCharts”