door poekmeister » vr 02 apr 2004, 21:25
hier is mijn aanepaste code met next bar statements
Inputs: RocAvgL(10), RocL(50), TrendL(100);
Inputs:LT1(40), LT2(11);
Inputs:ST1(40), ST2(11);
Inputs:SmoothL(10), LLimit(1.0), SLimit(1.0), VolatilityL(10);
Inputs:LTargetPts(10), STargetPts(10);
Inputs: LStpPts(0.6), LBepAPts(1.00), LBepBPts(0.01), SStpPts(0.6), SBepAPts(1.00), SBepBPts(0.01);
Inputs:PMult(100);
Variables: ?Smooth(0), Roc(0), Avg(0), Trend(0),Vol(0);
Variables: ?Atr(0), LStop(0), SStop(0);
Variables:LBep(False), SBep(False);
Smooth = XAverage((High+Low)*0.5, SmoothL);
Avg = XAverage(Close, RocAvgL);
Roc = Momentum(Avg, RocL);
Trend = XAverage(Close, TrendL);
Vol=Volatility(120);
If Marketposition = 1 Then Begin
{ Break even stop }
If Close > Entryprice + LBepAPts * PMult Then LBep = True;
If LBep Then ExitLong ("L-Bep")next bar Entryprice + LBepBPts * PMult Stop;
{ Profit Target }
Exitlong ("L-PT") next bar Entryprice + LTargetPts * PMult Limit;
{ Stop Loss }
ExitLong ("L-Stp") next bar Entryprice - LStpPts * PMult Stop;
End;
If Marketposition = -1 Then Begin
{ Break even stop }
If Close < Entryprice - SBepAPts * PMult Then SBep = True;
If SBep Then ExitShort next bar Entryprice - SBepBPts * PMult Stop;
{ Profit Target }
ExitShort ("S-PT")next bar Entryprice - STargetPts * PMult Limit;
{ Stop Loss }
ExitShort ("S-Stp") next bar Entryprice + SStpPts * PMult Stop;
End;
If (Marketposition <> 1 AND Close > Trend AND vCrossesabove(Roc,0) AND vol>4
{AND (time<1700)} Then Begin
Buy ("L-Roc-1") next bar Smooth + LLimit * XAverage(Range, VolatilityL) Limit;
LBep = False;
End;
If (Marketposition <> -1 AND Close < Trend AND vCrossesBelow(Roc,0) AND vol>4
{AND (time<1700)} Then Begin
Sell("S-Roc-1") next bar Smooth - SLimit * XAverage(Range, VolatilityL) Limit ;
SBep = False;
End;