Last order status

Questions about MultiCharts and user contributed studies.
filippo.milano
Posts: 44
Joined: 02 Jan 2015
Has thanked: 1 time

Last order status

Postby filippo.milano » 13 Jan 2020

Hi, i'm coding a signal and i like to know if it's possibile to have a variable that told you if the last order was triggered by a stoploss or by a takeprofit.

i declare this:
.....
Setprofittarget_pt(100);
SetStopLoss_pt(200);
....

I'd like to know if SetStopLoss has been taken or not, or the profittarget as been taken. So the second order will be different

Example:

If last.order stoploss taken then
begin
.......
If last.order profittarget taken then
begin
.......

There is so a variable that told you this?

Thanks in advance for your help

Filippo

User avatar
Svetlana MultiCharts
Posts: 645
Joined: 19 Oct 2017
Has thanked: 3 times
Been thanked: 163 times

Re: Last order status

Postby Svetlana MultiCharts » 24 Jan 2020

Hello, filippo.milano

Here is the example with exitname keyword:

once cleardebug;
if marketposition = 0 then
print (datetostring(datetime) ," ",exitname(1))
image.png
(82.16 KiB) Not downloaded yet


Return to “MultiCharts”