Stop Limit Order - buy and sell simultaneously, updates/cancels every period

Questions about MultiCharts and user contributed studies.
nerdycanard
Posts: 1
Joined: 12 Mar 2020

Stop Limit Order - buy and sell simultaneously, updates/cancels every period

Postby nerdycanard » 24 Apr 2020

hi, is it possible to place 2 StopLimit orders in different direction simultaneously?

e.g.
let's say at 10:00 a security is $100, I want to place a
stop buy order at $105
stop sell order at $95

at 10:15, price is now $102, neither stop order is triggered, I want to cancel the orders and place new ones as follows:
stop buy order at $107
stop sell order at $97

repeat until one side is triggered.....is this possible to code in PL?
Sorry if this has been answered before, and thank you for your time.

User avatar
Tammy MultiCharts
Posts: 200
Joined: 06 Aug 2020
Has thanked: 6 times
Been thanked: 65 times

Re: Stop Limit Order - buy and sell simultaneously, updates/cancels every period

Postby Tammy MultiCharts » 21 Aug 2020

Hello nerdycanard,

Buy and Sell Stop Limit orders, just like all other types of orders, can be sent simultaneously. MultiCharts will send them in an OCO group.
You can use the pre-built Channel Breakout Strategy as a reference, test it with Paper Trader or demo account, and modify if required. Stop Limit orders are used instead of Stop orders there.

Code: Select all

[IntrabarOrderGeneration = false] input: PriceH( High ), PriceL( Low ), Length( 20 ) ; var: BuyPrice(0), SellPrice(0); BuyPrice = HighestFC( PriceH, Length ); SellPrice = LowestFC( PriceL, Length ); Buy ( "ChBrkLE" ) next bar at BuyPrice + 1 point stop BuyPrice + 1 point limit; Sell Short ( "ChBrkSE" ) next bar at SellPrice - 1 point stop SellPrice - 1 point limit;


Return to “MultiCharts”