Calculate profit target in % from entry price

Questions about MultiCharts and user contributed studies.
wullenweber helmut
Posts: 60
Joined: 21 Dec 2007
Has thanked: 3 times
Been thanked: 9 times

Calculate profit target in % from entry price

Postby wullenweber helmut » 17 Dec 2013

I am wondering why

Code: Select all

setstopshare;
PT = (close[barssinceentry]/100*Target)*bigpointvalue;
setprofittarget(PT);
with target = 1

will close a position with 1 % Profit from Entryprice, but

Code: Select all

setstopshare;
PT = (entryprice/100*Target)*bigpointvalue;
setprofittarget(PT);
does not.

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

Re: Calculate profit target in % from entry price

Postby Henry MultiСharts » 18 Dec 2013

Hello Helmut,

Please print the PT value you are using for setprofittarget to debug the code:

Code: Select all

print(PT);


Return to “MultiCharts”