problem with "this bar at my_level"  [SOLVED]

Questions about MultiCharts and user contributed studies.
User avatar
PLB
Posts: 13
Joined: 28 Nov 2019
Has thanked: 6 times

problem with "this bar at my_level"

Postby PLB » 29 Feb 2020

Hi everyone, I hope to write in the right section as it is the first time that I ask for your help. I'm not very expert PowerLanguage and I'm going for the first one once trying to implement a code to automate a strategy. I have this problem:

Code: Select all

switch (StopLossMode) begin case (1): if marketposition = 1 and close < my_level then sell ("STL1") this bar on close; case (2): if marketposition = 1 and low <= my_level then sell ("STL2") this bar at my_level; <<<--- ------ Compiled with error(s): ------ Incorrect method name end;
I understand that I can use "this bar" only with "on close", but how do I do it exit the position at a certain price level?
Forgive me if the question is trivial, but I'm still inexperienced :-)

thank you very much

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

Re: problem with "this bar at my_level"

Postby TJ » 29 Feb 2020

Look up IntraBarOrderGeneration. (often referred to as IOG)



ps. No question is trivial. If everyone is an expert, there will be no need for this forum.

User avatar
PLB
Posts: 13
Joined: 28 Nov 2019
Has thanked: 6 times

Re: problem with "this bar at my_level"  [SOLVED]

Postby PLB » 20 Apr 2020

Thanks a lot, I managed to solve :)


Return to “MultiCharts”