Thanks for the code. I don't see how this will work. If you put some traces 
after the start and end variables like :

// Only interested in the visible bars 
lastbar = Status("lastvisible barindex" ) - 3; 
startBar = Status("firstvisible barindex" ); 

_TRACE("Startbar"+Startbar); 
_TRACE("Lastbar"+Lastbar); 

... both vars are empty. So the script will never run de loop ...

Regards, Ton.



  ----- Original Message ----- 
  From: Debdulal Bhattacharyya 
  To: [email protected] 
  Sent: Saturday, May 17, 2008 3:40 PM
  Subject: [amibroker] Re: Wolf Wave.


  Hi Ton,
  Here is the code for you.I have debugged the code after getting it 
  from this thread and corrected some of the very minor errors(But for 
  your information I never got "Subscript Out of range" error message.)
  and now its not showing any error.
  But the problem is that I can't understand the notto of the code.
  It just plotting candlestick chart in black background nothing else.
  How does it catch the wolf wave I dont know u please try to find it 
  out and let me know as early as possible.
  Debdulal Bhattacharyya.
  code
  ========

  /*Graph1 = ROC(EMA(High-Low,10),10);

  Volspike=V/EMA(V,10);
  Plot(Volspike,"Volume Spike",colorBlue,styleLine);

  Plot(1,"'ZSignal Line",colorRed,styleLine); */

  /*
  // second test
  //Potting EMA of 1Min Chart in Hourly Chart(Default Chart)

  PlotOHLC(O,H,L,C, "Multiple Time EMA",styleBar+styleThick);
  Minprice=TimeFrameGetPrice("C",in1Minute,0);
  MinEMA=EMA(Minprice,Param("1Min EMA Period",55,5,500));
  defaultEMA=EMA(C,Param("Default EMA Period",55,10,400));
  MinEMAcolor=ParamColor("1MinEMA Color",colorRed);
  defaultEMAcolor=ParamColor("Default EMA Color",colorBlue);
  Plot(MinEMA,"1Min EMA",MinEMAcolor);
  Plot(defaultEMA,"Default EMA",defaultEMAcolor);

  */

  // WolfeWave-V1. 01.afl
  // Author: Mac Johnson // Date: 28aug2005

  Version(4.70) ; // works from this version onwards

  SetChartBkColor( ParamColor( "Background colour",colorBlack) );

  Plot(C, "", colorGrey40, styleCandle );

  // Only interested in the visible bars
  lastbar = Status("lastvisible barindex" ) - 3;
  startBar = Status("firstvisibl ebarindex" );

  // Some visual choices ...
  BullPlot=ParamToggle("Plot bull signals", "No,Yes");
  BullGuide=ParamToggle("Plot bull guides","No, Yes");
  ExtendBull=ParamToggle("Extend bull plot", "No,Yes");
  BullWColor=ParamColor("Bullish wave colour", colorBrightGreen) ;
  BullTColor=ParamColor("Bullish trend colour", colorDarkGreen) ;

  BearPlot=ParamToggle("Plot bear signals", "No,Yes");
  BearGuide=ParamToggle("Plot bear guides", "No,Yes");
  ExtendBear=ParamToggle("Extend bear plot", "No,Yes");
  BearWColor=ParamColor("Bearish wave colour", colorRed);
  BearTColor=ParamColor("Bearish trend colour", colorBrown);

  // set AB's Peak/Trough percentage selection ratio
  ValidDiff=1/ Param("Peak ratio", 65, 0,500,5);

  for(Bar = startbar; Bar < lastbar; Bar++)
  {
  // Build Peak and Trough arrays
  P1 = Peak(H, validdiff, 1);
  P1Idx = Bar - PeakBars(H, ValidDiff, 1);

  P2 = Peak(H, validdiff, 2);
  P2Idx = Bar - PeakBars(H, ValidDiff, 2);

  T1 = Trough(L, validdiff, 1);
  T1Idx = Bar - TroughBars(L, ValidDiff, 1);

  T2 = Trough(Low, validdiff, 2);
  T2Idx = Bar - TroughBars(L, ValidDiff, 2);

  /* Test for a WolfeWave Bullish setup
  > *
  > * \ 2 + EPA
  > * \ Peak A is P2 / |
  > * \ /\ 4 / |
  > * \ / \ Peak C is P1 / |
  > * \ / \ /\ / |
  > * \ / \ / \ / |
  > * \/ \ / \ / |
  > * Trough X is T2 \ / \ / |
  > * 1 \ / \ / |
  > * \/ \ / |
  > * Trough B is T1 \/ |
  > * 3 5-D ETA
  > * Lines
  > * 1 - 4 = EPA
  > * 2 - 4 +
  > * 1 - 3 = ETA convergence
  > */
  if(BullPlot)
  {
  // are the peaks and troughs in the correct timewise order?
  PTValid = (P1Idx[Bar] > T1Idx[Bar]) AND (T1Idx[Bar] > P2Idx[Bar]) 
  AND (P2Idx[Bar] > T2Idx[Bar]);

  // are the peaks and troughs hi's and lo's correct relatively?
  HLValid = (P1[Bar] < P2[Bar]) AND (T1[Bar] < T2[Bar]) AND (P1[Bar] 
  < T1[Bar]);

  if(PTValid AND HLValid){
  // Bareish Wolfewave found. Draw pattern.
  PlotXA = LineArray(T2Idx[ Bar], T2[Bar], P2Idx[Bar], P2[Bar]);
  Plot(PlotXA, "", BullWColor, styleLine);

  PlotAB = LineArray(P2Idx[ Bar], P2[Bar], T1Idx[Bar], T1[Bar]);
  Plot(PlotAB, "", BullWColor, styleLine );

  PlotBC = LineArray(T1Idx[ Bar], T1[Bar], P1Idx[Bar], P1[Bar]);
  Plot(PlotBC, "", BullWColor, styleLine);

  if(BullGuide) {
  PlotAC = LineArray(P2Idx[ Bar], P2[Bar], P1Idx[Bar], P1
  [Bar],extendBull) ;
  Plot(PlotAC, "", BullTColor, styleLine|styleNoLabel);

  PlotXB = LineArray(T2Idx[ Bar], T2[Bar], T1Idx[Bar], T1
  [Bar],extendBull) ;
  Plot(PlotXB, "", BullTColor, styleLine|styleNoLabel);

  PlotXC = LineArray(T2Idx[ Bar], T2[Bar], P1Idx[Bar], P1
  [Bar],extendBull) ;
  Plot(PlotXC, "", BullTColor, styleLine|styleNoLabel);
  }
  }
  } // fi if(BullPlot)


  /* Test for a WolfeWave Bearish setup
  > *
  > * 3 5-D ETA
  > * Peak B is P1 /\ |
  > * /\ / \ |
  > * 1 / \ / \ |
  > * Peak X is P2 / \ / \ |
  > * /\ / \ / \ |
  > * / \ / \ / \ |
  > * / \ / \/ \ |
  > * / \ / Trough C is T1 \ |
  > * / \/ 4 \ |
  > * / Trough A is T2 \ |
  > * / 2 + EPA
  > *
  > *
  > * Lines
  > * 1 - 4 = EPA
  > * 2 - 4 +
  > * 1 - 3 = ETA convergence
  > */
  if(BearPlot)
  {
  // are the peaks and troughs in the correct timewise order?
  PTValid = (T1Idx[Bar] > P1Idx[Bar]) AND (P1Idx[Bar] > T2Idx[Bar]) 
  AND (T2Idx[Bar] > P2Idx[Bar]);

  // are the peaks and troughs hi's and lo's correct relatively?
  HLValid = (P1[Bar] > P2[Bar]) AND (T1[Bar] > T2[Bar]) AND (T1
  [Bar] 
  < P1[Bar]);

  if(PTValid AND HLValid){
  // Bullish Wolfewave found. Draw patterns
  PlotXA = LineArray(P2Idx[ Bar], P2[Bar], T2Idx[Bar], T2[Bar]);
  Plot(PlotXA, "", BearWColor, styleLine);

  PlotAB = LineArray(T2Idx[ Bar], T2[Bar], P1Idx[Bar], P1[Bar]);
  Plot(PlotAB, "", BearWColor, styleLine );

  PlotBC = LineArray(P1Idx[ Bar], P1[Bar], T1Idx[Bar], T1[Bar]);
  Plot(PlotBC, "", BearWColor, styleLine);

  if(BearGuide) {
  PlotAC = LineArray(T2Idx[ Bar], T2[Bar], T1Idx[Bar], T1
  [Bar],extendBear) ;
  Plot(PlotAC, "", BearTColor, styleLine|styleNoLabel);

  PlotXB = LineArray(P2Idx[ Bar], P2[Bar], P1Idx[Bar], P1
  [Bar],extendBear) ;
  Plot(PlotXB, "", BearTColor, styleLine|styleNoLabel);

  PlotXC = LineArray(P2Idx[ Bar], P2[Bar], T1Idx[Bar], T1
  [Bar],extendBear) ;
  Plot(PlotXC, "", BearTColor, styleLine|styleNoLabel);
  }
  }
  } // fi if(BearPlot)
  } // fi for(Bar =
  _N(Title="") ;



   

Reply via email to