Hello!
I am working on an inside bar strategy and I´ve found som exit criterias, but I believe the code is from MetaStock and I wonder if it is possible to convert it to PRT code?
Here is the code:
tr = 0.75
si = 0.75
else if marketposition = 1 then begin
sell next bar at entryprice + entryprice*tr/100 limit;
sell next bar at entryprice – entryprice*si/100 stop;
end
else if marketposition = -1 then begin
buy to cover next bar at entryprice – entryprice*tr/100 limit;
buy to cover next bar at entryprice + entryprice*si/100 stop;
end
If someone could convert this it would be greatly appreciated!
I think that it could be converted this way:
itr = 0.75
si = 0.75
if longonmarket then
sell at tradeprice + tradeprice*itr/100 limit
sell at tradeprice – entryprice*si/100 stop
elsif shortonmarket then
exitshort at tradeprice – tradeprice*itr/100 limit
exitshort at tradeprice + tradeprice*si/100 stop
endif
The only thing not working in your code is “entryprice” PRT says the variable is undefined
Thanks
Replace entryprice with tradeprice. I think it is a typo by Nicolas.