Referencing the open of a position

Questions about MultiCharts and user contributed studies.
Tetsuya
Posts: 5
Joined: 22 Aug 2019
Has thanked: 1 time
Been thanked: 1 time

Referencing the open of a position

Postby Tetsuya » 26 Aug 2019

Hi!

I'm trying to write an exit for a specific entry without it interfering with other entries. What I came up with is tracking that entry with a variable (TOpen) but I've run into some problems.

Is there a command to specifically reference when a position has actually been opened on the chart by a specific signal?

What I have tried so far:

- normal evaluation of entry condition

Code: Select all

if TrendCount>=TrendBars and Tails>=TailCount and barstatus=0 then begin
sellshort("Tail SE") next bar market;
TailSL=maxlist(High[1],TailValues[0]);
TOpen=1;
end;
This doesn't work for me because it will also trigger an update of the variables TailSL and TOpen if the entry logic is met but no actual trade is made because of a prior entry in the same direction and position limit settings.


- PosTradeEntryBar

Code: Select all

if PosTradeEntryBar(0,0)=currentbar then begin
TailSL=maxlist(High[1],TailValues[0]);
TOpen=1;
end;
This doesn't work because it will also trigger an update of TailSL and TOpen if any other strategy entry is triggered.


The solution I was thinking of was a command like PosTradeEntryBar but also referencing a specific entry.
Any way of doing this?

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

Re: Referencing the open of a position

Postby Svetlana MultiCharts » 29 Aug 2019

Tetsuya,

PosTradeEntryName keyword may suit your needs.


Return to “MultiCharts”