PureBytes Links
Trading Reference Links
|
Would some kind soul tell me how to fix this code?
I'm using EOD data. After buying 2 contracts on the close, I want a stoploss
under the recent Low point(ie the previous bar's low) and if the close is in
the lower third of the range on the day after entry I want to exit both
contracts. I want a profit target to exit one of the contracts and a
trailing stop for any remaining contracts.
Vars:MP(0),ATR(0),Lpoint(0);
MP=marketposition;
ATR= AvgTrueRange(5);
If L[2]>L[1] and C>H[1] and C>L+.67*Range and Range>Range[1]
then buy 2 contracts on close; {enable multiple entries by same
signal}
If MP[1]<>1 and MP=1 then Lpoint = L[1]; {this is to tag the low of the
swinglowbar}
Exitlong("Stoploss") all contracts at Lpoint-2 points on stop;
{initial stop loss}
If BarsSinceEntry=1 and C<L+.33*Range then exitlong ("1st day out") on
close;
Exitlong("ProfitTarget") 1 contract at EntryPrice+1.5*ATR on limit;
{This exits on the open of the next
day. Why?}
Exitlong("VolaStop") all contracts at C-.5*ATR on stop;
Thankyou for any help you may offer.
|