I want not MC sends Limit/Stop orders to broker(market)!

Questions about MultiCharts and user contributed studies.
Gaempi
Posts: 32
Joined: 27 Jul 2010
Location: Switzerland
Has thanked: 1 time
Been thanked: 2 times

I want not MC sends Limit/Stop orders to broker(market)!

Postby Gaempi » 03 Sep 2012

I work with different autotrading systems with limit an stop orders, but i prefer that MC not send the orders to the market. I want MC only supervise the orders at market and send buy or sell orders, only if a limit or stop is reached. How can i program this in PowerLanguage?

evdl
Posts: 398
Joined: 19 Jan 2011
Location: Netherlands
Has thanked: 84 times
Been thanked: 123 times

Re: I want not MC sends Limit/Stop orders to broker(market)!

Postby evdl » 03 Sep 2012

Maybe you can use this as an example to get what you want.

Code: Select all

inputs:
Profit(0), {% of the average entry price}
Stoploss(0); {% of the average entry price}

        
variables:
profit_long (0),
profit_short (0),
Stoploss_long(0),
stoploss_short(0);

// CONDITIONS ----------------------------------------
If date <> date[1] then begin;

// Profit and stoploss
   Profit_long = (AvgEntryPrice_at_Broker * profit)+ AvgEntryPrice_at_Broker;
   Profit_short = (AvgEntryPrice_at_Broker * -profit)+ AvgEntryPrice_at_Broker;
   Stoploss_long = (AvgEntryPrice_at_Broker * -stoploss)+ AvgEntryPrice_at_Broker;
   Stoploss_short = (AvgEntryPrice_at_Broker * stoploss)+ AvgEntryPrice_at_Broker;

// Exit Conditions ---------------------------------------------------------------------------------------

// Profit target
// Long exit:   
   If close >= profit_long then begin
    Sell ("CloseProfitLong") next bar profit_long limit;
   end;
// Short exit
   if close <= profit_short then begin
    BuytoCover ("CloseProfitShort") next bar Profit_short limit;
   end;

// Stoploss  --------------------------------------------------------------------------------------------
// Long exit:
   if close >= stoploss_long then begin
    Sell ("StopLossLong") next bar Stoploss_long stop;
   end;
// Short exit:   
   if close <= stoploss_short then begin
    Buytocover ("StopLossshort") next bar Stoploss_long stop;
   end;
end;
These users thanked the author evdl for the post:
JoshM

User avatar
Henry MultiСharts
Posts: 8450
Joined: 25 Aug 2011
Has thanked: 1207 times
Been thanked: 2706 times

Re: I want not MC sends Limit/Stop orders to broker(market)!

Postby Henry MultiСharts » 05 Sep 2012

Gaempi, do you mean you do not want the order to be kept at broker waiting for price level but instead sent at limit/stop price level and immediately executed?

Gaempi
Posts: 32
Joined: 27 Jul 2010
Location: Switzerland
Has thanked: 1 time
Been thanked: 2 times

Re: I want not MC sends Limit/Stop orders to broker(market)!

Postby Gaempi » 06 Sep 2012

Hello Hendry

Yes, I do not want the order to be kept at broker (market) waiting for price level. I want instead sent at limit/stop price level a market order.

Why? The problem is in premarket trading and aftermarket trading the volume is thin. The bigger traders move the price to my stop or limit order level and then the prices go back to the 'normal' level. I want to avoid this by holding the limit an stop orders at my PC till a stop or limit level is reached and a market order goes to the market.

User avatar
Henry MultiСharts
Posts: 8450
Joined: 25 Aug 2011
Has thanked: 1207 times
Been thanked: 2706 times

Re: I want not MC sends Limit/Stop orders to broker(market)!

Postby Henry MultiСharts » 07 Sep 2012

In your code you can send the order type you like when the desired price level is met.

You can also submit a feature request to emulate price orders with market orders (price level is monitored in MC in this case and the order is sent only when the level is reached) to the Project Management of our web site so other users can vote for it: https://www.multicharts.com/pm/

paulc
Posts: 43
Joined: 26 Sep 2012
Has thanked: 7 times
Been thanked: 2 times

Re: I want not MC sends Limit/Stop orders to broker(market)!

Postby paulc » 26 Sep 2012

Henry MultiСharts wrote:In your code you can send the order type you like when the desired price level is met.


How do i do this? i wish to amend the profit target order signal below:

inputs: PositionBasis( false ), Amount( 5 ) ;

if PositionBasis then
SetStopPosition
else
SetStopShare ;

SetProfitTarget( Amount ) ;

User avatar
Henry MultiСharts
Posts: 8450
Joined: 25 Aug 2011
Has thanked: 1207 times
Been thanked: 2706 times

Re: I want not MC sends Limit/Stop orders to broker(market)!

Postby Henry MultiСharts » 28 Sep 2012

You can monitor Openpositionprofit from your script (same as SetProfitTarget's Amount) and once the desired amount is reached generate an order you need.


Return to “MultiCharts”