OCO order ?

Questions about MultiCharts and user contributed studies.
paul.robillard
Posts: 30
Joined: 22 Mar 2012
Location: Western Europe
Has thanked: 6 times

OCO order ?

Postby paul.robillard » 02 May 2012

if .... then

// would this be the right / good way to send a Buy market order with Takeprofit and Stoploss limits order to the market ?

begin
buy ("tiers1") 1 contract next bar at market ;
TP1L = 5 ; // Take Profit "Level 1" Long
SLL = (lowest(low,3) - 1) ; // StopLoss set to the Lowest Low of the 3 bars previous to the buy signal.
setstopposition ;
setstoploss(SLL) ;
setprofittarget(entryprice + TP1L) ;
end;

User avatar
TJ
Posts: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: OCO order ?

Postby TJ » 02 May 2012

if .... then

// would this be the right / good way to send a Buy market order with Takeprofit and Stoploss limits order to the market ?

begin
buy ("tiers1") 1 contract next bar at market ;
TP1L = 5 ; // Take Profit "Level 1" Long
SLL = (lowest(low,3) - 1) ; // StopLoss set to the Lowest Low of the 3 bars previous to the buy signal.
setstopposition ;
setstoploss(SLL) ;
setprofittarget(entryprice + TP1L) ;
end;

see post #3
viewtopic.php?f=16&t=6929




ps. please use code tag when posting codes.

paul.robillard
Posts: 30
Joined: 22 Mar 2012
Location: Western Europe
Has thanked: 6 times

Re: OCO order ?

Postby paul.robillard » 02 May 2012

Ok thanks ! :)

I now (seem to) get the OCO orders but i get right out of the market :// Can you tell me why ? It does not seem to compute the "entryprice" ? It all goes real fast but from the blink, i saw the TP order was set to 5 and not (entryprice + 5). Why ?


if ... then

Code: Select all

begin
buy ("tiers1L") 1 contract next bar at market ;
TP1L = (entryprice + 5) ;
SLL = (lowest(low,3) - 1) ;
end;

setstoploss(SLL) ;
setprofittarget(TP1L) ;
Thanks :)


Return to “MultiCharts”