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

Re: [amibroker] Wolf Wave



PureBytes Links

Trading Reference Links

I probably no longer "speak" Metastock very well but I don't think that the last line of Col A is correct and should generate an error.  In addition, something must be missing because it does not appear that this code provides the bottom line Wolfe Wave result of price and time targets for the post-5th wave leg.  These targets are generated by a Tradestation code (see below) written by Clyde Lee, Sytech, which was posted on another board and can be converted to AB.  An idealized Wolfe Wave from the Wolfe Wave website is also given below.  As shown, a trendline is formed with 1, 3, 5 (can be somewhat higher/lower).  The time target is the apex of the triangle produced from trendlines 1,3 and 2,4.  Trendline 1,4 defines the price target at the time target.
 
Wolfe Waves are easy to spot by eye so you might want to go that route.  As is characteristic of pattern codes (e.g., Wolfe Waves, Fibonacci Patterns, etc.) pivots must be defined and they rarely follow the same defining conditions (e.g., % change).  Eyeballing, however, can quickly pick them out and using, for example, the logic in the KB code at  http://www.amibroker.com/kb/2006/05/06/discretionary-equity/ it is possible to click on pivots (not unlike the way some of the charting tools (e.g., pitchfork) work), specify their names (e.g., 1, 2, etc.), and then use them for plotting or AA output.  Until this functionality is available to AB users, it should be possible to use the KB code approach to write a function that can be used pattern charting, including Wolfe Waves.
 
Enjoy.
 
Bill
 
=========================
 
 
 
========================================
 
Tradestation code:
 
Inputs:  NBars(13),     {Number of bars for Swing_Lee    pivot picking }
     MaxBars(250);  {Maximum number of bars forward to search for  }
                        {Match/Crossing of ETA lines to set end EPA    }
                        {If this is set to a very high number, the time}
            {to compute and plot will become excessive.    }
 

Vars:    TPCount(0),Direct(0),
        HoldPrice(0),BarsBk(0),
        Slope1(0),Slope2(0),
        ETA1(0),ETA2(0),EPA(0),
       NewDate(0),NewTime(0);
 
Arrays:  TPDate[4](0),TPTime[4](0),TPBar[4](0),TPPrice[4](0),TPDirect[4](0);
 

Direct=Swing_Lee_Simple(NBars,False);
 

If Sign(Direct)<>Sign(Direct[1]) then begin
 BarsBk=AbsValue(Direct);
 {Found a TurningPoing so increase count}
 TPCount=TPCount+1;
 {Save the proper price}
  If Direct<0 then HoldPrice=High[BarsBk]
            else HoldPrice=Low [BarsBk];
  {Push the Stack}
 For Value1=1 to 3 begin
   TPDate[Value1]  =TPDate[Value1+1];
   TPTime[Value1]  =TPTime[Value1+1];
  TPBar[Value1]   =TPBar[Value1+1];
   TPPrice[Value1] =TPPrice[Value1+1];
   TPDirect[Value1]=TPDirect[Value1+1];
  End;  
 {Save Current Data}
 TPDate[4]  =Date[BarsBk];
 TPTime[4]  =Time[BarsBk];
 TPBar[4]   =CurrentBar-BarsBk;
 TPPrice[4] =HoldPrice;
 TPDirect[4]=Sign(Direct);
 
 Plot1[BarsBk](HoldPrice,"TP");
 
 
 
 If TPCount>3 then begin
   {If we have 4 TP's then we can look for WW}
  Condition1=False;Condition2=False;
  Slope1=(TPPrice[3]-TPPrice[1])/(TPBar[1]-TPBar[3]);
  Slope2=(TPPrice[4]-TPPrice[2])/(TPBar[2]-TPBar[4]);
  If TPDirect[1]>0 then begin
   {Look for Bullish WW}
      Condition1=
          TPPrice[4]>TPPrice[3] and
      TPPrice[4]<TPPrice[2] and
      TPPrice[3]<TPPrice[1] and
      TPPrice[4]>TPPrice[1] and
      Slope1    <Slope2     ;
     
    End
  Else Begin
   {Look for Bearish WW}
      Condition2=
      TPPrice[4]<TPPrice[3] and
      TPPrice[4]>TPPrice[2] and
      TPPrice[3]>TPPrice[1] and
      TPPrice[4]<TPPrice[1] and
      Slope1    >Slope2     ;
    End;
 
  {Plot the wave and lines if it exists}
   If Condition1 or Condition2 then begin
 
   ETA1=TL_NEW(TPDate[1],TPTime[1],TPPrice[1],TPDate[3],TPTime[3],TPPrice[3]);
   ETA2=TL_NEW(TPDate[2],TPTime[2],TPPrice[2],TPDate[4],TPTime[4],TPPrice[4]);
   EPA =TL_NEW(TPDate[1],TPTime[1],TPPrice[1],TPDate[4],TPTime[4],TPPrice[4]);
   Value5=TL_New(Date,Time,TL_GetValue(ETA1,Date,Time),
                Date,Time,TL_GetValue(ETA2,Date,Time));
   Value1=mod(tpcount,6)+2;
   Value1=red;
   TL_SetColor(ETA1,VALUE1);
   TL_SetColor(ETA2,VALUE1);
   TL_SetColor(EPA ,VALUE1);
   TL_SetColor(Value5,Red);
   TL_SetSize(Value5,3);
 

   Value2=0;
   Value1=0;
     While Value2=0 and Value1< MaxBars begin
    Value2=BarsToDate_Time(TPBar[4]-TPBar[3], Value1, NewDate, NewTime);
    Value3=TL_GetValue(ETA2, NewDate, NewTime)-TL_GetValue(ETA1, NewDate, NewTime);
    If Condition1 and Value3>0 then Value2=0;
    If Condition2 and Value3<0 then Value2=0;
     Value1=Value1+1;
     End;
   If Value2<>0 or Value1=MaxBars then begin
    TL_SetEnd(ETA1, NewDate, NewTime, TL_GetValue(ETA1, NewDate, NewTime));
    Value7=TL_GetValue(ETA2, NewDate, NewTime);
    TL_SetEnd(ETA2, NewDate, NewTime, Value7);
    Value8=Text_New(NewDate,NewTime,Value7,"ETA");
        Text_SetStyle(Value8, 0, 2);
    Value7=TL_GetValue(EPA , NewDate, NewTime);
    TL_SetEnd(EPA , NewDate, NewTime, Value7);
    Value8=Text_New(NewDate,NewTime,Value7,"EPA");
        Text_SetStyle(Value8, 0, 2);
   End;
  End;
 End;
 
End;  
 
 
 
 
__._,_.___

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html





SPONSORED LINKS
Investment management software Investment property software Investment software
Investment tracking software Return on investment software

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___