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

Re: [amibroker] I tried this P&F code but........



PureBytes Links

Trading Reference Links

Percentage box size means the box size needs to be an array, and so
you need to change the code for this.
Normal box size is set value so is not an array

-- 
Cheers
Graham Kav
AFL Writing Service
http://www.aflwriting.com


On 04/02/2008, cassianoqs <cassianoqs@xxxxxxxxx> wrote:
> I tried this P&F code but I get different results from stockcharts or
> Bull's-Eye Broker. What's wrong with this Percentage Scaling Method ???
>
>
> //code start here
>
> SetBarsRequired(100000,100000);
>
> //Size for P&F boxes
>
> Bbb = Param("Box ", 1, 0.2, 10, 0.1);
> box=exp(log(C))/100*bbb;
>
> HX = round((H/box)*10)/10;
> LX = round((L/box)*10)/10;
> RH = floor(HX);
> FL = ceil(LX);
>
>
> // initialize first element
> j = 0;
>
> Reverse = 3;                      // reversal requirement
>
> PFC[j] = FL[0];
> PFO[j] = PFC[j] + 1;
> down = 1;                  // By default the first bar is a down bar.
> up = 0;
> swap = 0;
>
> // perform the loop that produces PF Chart
> for( i = 1; i < BarCount; i++ )
> {
>
>  if( FL[i] <= PFC[j]-1 && down)         //continue down
>  {
>   PFC[j] = FL[i];
>   PFO[j] = PFC[j] + 1;
>  }
>  else
>  {
>   if( RH[i] >= PFC[j] + Reverse && down)  //Change direction to up
>   {
>    j++;
>    swap = 1;
>    PFC[j] = RH[i];
>    PFO[j] = PFC[j]-1;
>   }
>  }
>  if( RH[i] >= PFC[j] + 1 && up)         //Continue up
>  {
>   PFC[j] = RH[i];
>   PFO[j] = PFC[j] - 1;
>  }
>  else
>  {
>   if( FL[i] <= PFC[j] - Reverse && up)   //Change direction to down
>   {
>    j++;
>    PFC[j] = FL[i];
>    PFO[j] = PFC[j] + 1;
>    swap = 1;
>   }
>  }
>  if( swap )
>  {
>   swap = 0;
>   if( up )
>   {
>    up = 0;
>    down = 1;
>   }
>   else
>   {
>    up = 1;
>    down = 0;
>   }
>  }
> }
> delta = BarCount - j-1;
>
>
> PFO = Ref( PFO, -delta );
> PFC = Ref( PFC, -delta );
>
> // High-Low range sets the height of the P&F bar
> H = IIf(Ref(PFC,-1)>Ref(PFO,-1),Ref(HHV(PFC,1),-1)-1,Max(PFO,PFC))*Box;
> L = IIf(Ref(PFC,-1)<Ref(PFO,-1),Ref(LLV(PFC,1),-1)+1,Min(PFO,PFC))*Box;
> O =
> IIf(Ref(PFC,-1)>Ref(PFO,-1),Ref(HHV(PFC,1),-1)-1,IIf(Ref(PFC,-1)<Ref(PFO,-1),Ref(LLV(PFC,1),-1)+1,PFO))*Box;
>
> // the difference between Open AND Close should be set to box size
> // the sign decides if X or O are plotted
> C = O + Box * IIf( PFC > PFO, 1,-1);
>
> GraphXSpace = 2;
> Title ="P&F  " + Name()+ "  PF HiLo, H: " + H+ ", L: " + L+", Box: "+
> box + ", Reversal: " + reverse;
>
>
> Plot( C, "P&F Chart Close", IIf( PFC > PFO, colorBlue, colorRed ),
> styleNoLabel+stylePointAndFigure);
>


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
 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/