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

Re: system tester & pastaga



PureBytes Links

Trading Reference Links


Tomacz,

Incredible, if I change the period of the setup, I have no bug.
example if in the setup of the previous code I write:
Setup=OBV()>MA(OBV(),19) ;

19 is one day less than the channel lenght of 20
chtop = Ref( HHV( High, 20), -1 );
chbot = Ref( LLV( Low, 10 ), -1 );

so it is a problem of data ( not data loaded but data to built the 
indicators).

> Tomacz,
> I am bugged with buyprice & sellprice on stop 
> or the system tester doesn't love me.
> 
> 1/for me a system with stop is :
> a buy = binary peak ( 0 or 1)
> a sell= binary peak ( 0 or 1)
> a buyprice= a price between the H and low when the buy ==1
> a sellprice= a price between the h and the low when the sell ==1
> 
> 2/ so if I take
> Buy= N;
> Sell= Xb ; 
> BuyPrice= C; 
> SellPrice= C; 
> 
> the results are correct
> 
> if I change to
> Buy= N;
> Sell= Xb ; 
> BuyPrice= Np; 
> SellPrice= Xp; 
> 
> where Np and Xp are the value of a stop, the results are wrong, 
even 
> sometimes the buy&hold is wrong
> 
> 3/youdon't believe me??
> 
> try to plot the buyprice & sellprice , they gives correct value on 
a 
> chart
> try to test the system, that doen't work.
> 
> MaxGraph=14;
> 
> 
> chtop = Ref( HHV( High, 20), -1 );
> chbot = Ref( LLV( Low, 10 ), -1 );
> 
> Setup=OBV()>MA(OBV(),30) ;
> N= Ref(setup,-1) AND H>(Chtop*1.005) ; 
> N= Hold(N ==0,2) AND N;
> Np= ValueWhen(N,(Chtop*1.005),1);
> 
> /****************Stop Profit****************/
> Pct=5; 
> Spp=ValueWhen(N,Np*(1+(Pct/100)));
> Sp= H>spp AND BarsSince(N)!=0;
> Sp=Hold(Sp==0,2) AND Sp;
> 
> /****************Stop Loss******************/
> PerSl= 0.99; /* Optimize("Pct",0.99,0.975,0.995,0.005); */
> Slp= ValueWhen(N,LLV(L,5))*PerSl;
> Sl= L<Slp AND BarsSince(N)!=0;
> Sl= Hold(Sl==0,2) AND Sl;
> 
> /************Stop******************/
> Stop= Sp OR Sl;
> Xb= ExRem(Stop,N);
> 
> /**************Define Stops Price*********/
> Spp=IIf(Xb,IIf(O>= Spp ,O,
> IIf(H> Spp , Spp ,0)),0); 
> Slp=IIf(Xb,IIf(O<= Slp ,O,
> IIf(L< Slp, Slp ,0)),0); 
> Xp=
> IIf(Xb,IIf(Spp>0,Spp,IIf(Slp>0,Slp,0)),Close);
> Xp=ValueWhen(Xb,Xp);
> 
> /***********Buy& Sell Signals**************/
> Buy= N;
> Sell= Xb ; 
> BuyPrice= Np; 
> SellPrice= Xp; 
> 
> 
> /****************Graph****************/
> Graph0=Close; 
> Graph0Style=64;
> Graph0BarColor = IIf( Buy, 6, IIf(Sell , 4 , 1 ));
> Graph3=np; 
> Graph3Style=1;
> Graph3BarColor =5;
> Graph4=xp; 
> Graph4Style=1;
> Graph4BarColor =6;
> /**end**************/