PureBytes Links
Trading Reference Links
|
{I would appreciate some help on the coding below, I
can't get it to work as I intend:}
Var:prevtrade(0),HL20(0),CanShort(0);
If @MarketPosition = +1 then prevtrade = +1;
If @MarketPosition = -1 then prevtrade = -1;
If (prevtrade=-1) and BarsSinceExit(1)=1 and
high[1]=highest(h,20)[1] then HL20=low[1]; {if a short
trade exit occurs on a 20 day high then HL20=20 day
high}
If (prevtrade=-1) and BarsSinceExit(1) >1 and
High=Highest(h,20) then HL20=low; {If after the exit a
new 20 day high occurs then HL20=New 20 day high}
If (prevtrade=-1) and XMa(c,25)[1] > XMa(close,25)
then CanShort=false; {THIS IS THE PART I CAN'T GET TO
WORK. What I want is: If the last trade was a Short
trade and exited and the XMa went down on all bars
since the Exit, then the trade can be triggered. If,
however, the XMA goes up on any bar since the exit,
the set up is cancelled and no trade can be taken}
If CanShort and XMA(close,25) < XMA(c,25)[1] and
close < HL20 then sell("ReEnter Short") at Low - 1
point stop;
{Thanks in advance,
Mike Kittelson}
=====
Regards,
Mike Kittelson
|