Show Custom Stop Price on chart

Questions about MultiCharts and user contributed studies.
Wapi
Posts: 25
Joined: 31 Mar 2017
Been thanked: 1 time

Show Custom Stop Price on chart

Postby Wapi » 16 Mar 2018

Hi all,
is it possible to see on the chart the price level of the stop line as stop signal below?
__________________________________________________________________________________
Inputs: Label1("Stop fisso punti"),
StopLossAmt( 40 ),
Label3("Disegna Linea"),
PlotLinea (TRUE),
ColoreLinea(magenta),
ShowDebug(false);


Vars:
EP(0), //entryprice
StopLong (0), //trailing
StopShort(0), //trailing
LineaLongStop (0), //trailing
LineaShortStop(0), //trailing
MyDate(0); //debug


{COSTRUZIONE DEL TRAILING -}
EP=entryprice;
StopLong=l-StopLossAmt;
StopShort=h+StopLossAmt;

//LONG stop
If marketposition=1 then begin

StopLong=Maxlist(StopLong[1],c-StopLossAmt,EP-StopLossAmt);

If L < StopLong then begin
Sell ("LNGSTOP") next bar at Open;
end;
If PlotLinea then begin
LineaLongStop = TL_New( D, T, StopLong, D[1], T[1], StopLong[1]);
Tl_setcolor(LineaLongStop, ColoreLinea);
End;
End;
_____________________________________________________________________________________

Tnx.

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

Re: Show Custom Stop Price on chart

Postby TJ » 16 Mar 2018

See post #1 & #2
viewtopic.php?t=11713

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Show Custom Stop Price on chart

Postby Henry MultiСharts » 16 Mar 2018

Hello Wapi,

Your strategy should open a position first, then the code you have provided above will plot the line for the stop order.

Wapi
Posts: 25
Joined: 31 Mar 2017
Been thanked: 1 time

Re: Show Custom Stop Price on chart

Postby Wapi » 21 Mar 2018

TJ: sry for not tagging the code

Code: Select all

Inputs: Label1("Stop fisso punti"),
StopLossAmt( 40 ),
Label3("Disegna Linea"),
PlotLinea (TRUE),
ColoreLinea(magenta),
ShowDebug(false);


Vars:
EP(0), //entryprice
StopLong (0), //trailing
StopShort(0), //trailing
LineaLongStop (0), //trailing
LineaShortStop(0), //trailing
MyDate(0); //debug


{COSTRUZIONE DEL TRAILING -}
EP=entryprice;
StopLong=l-StopLossAmt;
StopShort=h+StopLossAmt;

//LONG stop
If marketposition=1 then begin

StopLong=Maxlist(StopLong[1],c-StopLossAmt,EP-StopLossAmt);

If L < StopLong then begin
Sell ("LNGSTOP") next bar at Open;
end;
If PlotLinea then begin
LineaLongStop = TL_New( D, T, StopLong, D[1], T[1], StopLong[1]);
Tl_setcolor(LineaLongStop, ColoreLinea);
End;
End;
Henry: yes, this code is to be placed in a strategy where another signal open a position and
yes, the code plot the line for the stop order.
I'd like to know if it's possible to see the price of the stop order plotted on the right side of the chart like the prebuild "setstoploss(StopLossAmt) " do.

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Show Custom Stop Price on chart

Postby Henry MultiСharts » 06 Apr 2018

Hello Wapi,

That is possible to program a code that will plot a line at the order price level at the desired position, but the code you have provided above is not designed to do that.

Wapi
Posts: 25
Joined: 31 Mar 2017
Been thanked: 1 time

Re: Show Custom Stop Price on chart

Postby Wapi » 06 Apr 2018

Referring to the prebuild "setstoploss" I was not clear in what i'm looking for :
I see the line of the stop order. Can I plot the price of the stop on the right of the line ?
Can I plot the level of the stop as text ?

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Show Custom Stop Price on chart

Postby Henry MultiСharts » 19 Apr 2018

Wapi,

Your code can place Text drawings on the chart:
https://www.multicharts.com/trading-sof ... xt_Drawing


Return to “MultiCharts”