Calculate profit target in % from entry price

Questions about MultiCharts and user contributed studies.
wullenweber helmut
Posts: 57
Joined: 21 Dec 2007
Has thanked: 2 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: 9121
Joined: 25 Aug 2011
Has thanked: 1258 times
Been thanked: 2927 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”