[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Code - help please



PureBytes Links

Trading Reference Links

Hi

Being a newbe- ish  to TS2000i .. i wrote this 
code which should give percentage exits for  trading stocks.
but it does not seem to work properly.

Any help would be greatly appreciated.

Many thanks

Noel


Input: PcntStop(1), PcntProfit(1);

Var: LongPrice(0),ShortPrice(0),LongStop(0),ShortStop(0);

LongPrice = EntryPrice + ((EntryPrice * PcntProfit)/100);
ShortPrice = EntryPrice - ((EntryPrice * PcntProfit)/100);

LongStop = EntryPrice - ((EntryPrice * PcntStop)/100);
ShortStop = EntryPrice + ((EntryPrice * PcntStop)/100);

if high >= LongPrice or low <= LongStop then exitlong;
if low <= ShortPrice or high >= ShortStop then exitshort;