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

Data mining



PureBytes Links

Trading Reference Links

My goal is to find out how much one time series moves when another is rising
or falling.  I'd like to see the total number of ATR''s over the data
history that I capture if I just bot or sold Data 1 when Data2 said it made
sense.  I defined upward movement in Data2 in condition1 and a break in that
condition as Condition2.  I'd also like to see what the average number of
ATR's I make in each move.  I have wrapped the calculations in a For loop so
that the  best length of the Momentum function is found and used.  The
condition1 could be any kind of filter so one could replace it with If RSI
<0 or if ADX>30 how much does the market rise or fall so the indicator is
intended to be used for any kind of data mining .. but it is not working ..
any ideas how to fix?


Inputs:D2(close of data2),HighestMomlen(40);
Vars:Mom(0),Outcome(0),BestOutcome(0),Momlen(1),BestMomlen(0),UHits(1),DHits
(0),BegUPrice(0),EndUPrice(0),Upmove(0),BegDPrice(0),EndDPrice(0)
 ,DnMove(0),Totalmove(0);

 Mom=Momentum(D2,Momlen);

Condition1=Mom>0 and Mom>Mom[1];
Condition2=Mom<0 or Mom<Mom[1];
Condition3=Mom<0 and Mom<Mom[1];
Condition4=Mom>0 or Mom>Mom[1];

UHits=0;
DHits=0;
BestOutcome=0;

For Momlen=1 to HighestMomlen begin


  If Condition1 then begin
   UHits=UHits+1;
   BegUPrice=close;
  end;

  If Condition3 then begin
   DHits=DHits+1;
   BegDPrice=close;
  end;



 If Condition2 then EndUprice=close;
 If Condition4 then EndDprice=close;

Upmove=Iff(UHits=0,0,(100*(EndUprice-BegUprice))/BegUprice);
Dnmove=Iff(DHits=0,0,(100*(BegDprice-EndDprice))/BegDprice);
Totalmove=((Upmove+Dnmove)/2)/AvgTrueRange(5);

  If Totalmove>BestOutcome then  begin
    BestOutcome=Upmove;
    Bestmomlen=Momlen;
 end;
end;


Plot1(BestOutcome,"Result");
{Plot2(Bestmomlen,"BestCount");}

Commentary("Bestmomlen=",Bestmomlen);