Zum Inhalt springen
View in the app

A better way to browse. Learn more.

#T/N/X/T

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

P&F Charts

Geschrieben

Ich habe hier zwei Codes, die für Forex geeignet sein sollen. Aber bei mir funktionieren die nicht.

Könnte mal jemand bitte testen?

 

_SECTION_BEGIN("P&F1");
symbol = Name();
ccy2= StrRight(symbol,3);
Ccy1= StrLeft(symbol,3);
decimals=IIf(ccy2 == "JPY"  10, 10000);
Box = Param("Box", 10, 1, 100, 1)/decimals;
Reverse = Param("Reverse",3, 1, 5, 1);
j = 0;
Lo[0] = Box * ceil(L[0]/Box) ;
Hi[0] = Lo[0] + box;
direction = 0;
for( i = 1; i < BarCount; i++ )
{	
if(direction[j] == 0)
{
	if(L[i] <= Lo[j] - Box)
	{
		Chg = Lo[j] - L[i];
		n= floor(Chg/box);
		Lo[j] = Lo[j] - n* box;
	}
	else
	{
		if(H[i] >= Lo[j] + Reverse*Box)
		{
			Chg = H[i] - Lo[j];
			n = floor(Chg/box);
			j++;
			direction[j] = 1;
			Hi[j] = Lo[j-1] + n* Box;
			Lo[j] = Lo[j-1] + Box;
		}
	}
}
else
{
	if(H[i] >= Hi[j] + Box)
	{
		Chg = H[i] - Hi[j];
		n= floor(Chg/box);
		Hi[j] = Hi[j] + n*box;
	}
	else
	{
		if(L[i] <= Hi[j] - Reverse * Box )
		{
			Chg = Hi[j] - L[i];
			n= floor(Chg/box);
			j++;
			direction[j] = 0;
			Lo[j] = Hi[j-1] - n*box;
			Hi[j] = Hi[j-1] - Box;			
		}
	}
}

}
delta = BarCount - j -1;
direction = Ref(direction, - delta);
Hi = Ref(Hi, -delta) + Box/2;
Lo = Ref(Lo, -delta)- Box/2;
Cl = IIf(direction == 1, Hi, Lo);
Op = IIf(direction == 1, Cl - Box, Cl + Box); 
PlotOHLC(Op, Hi, Lo, Cl,"", colorLightYellow , stylePointAndFigure);
_SECTION_END();

 

_SECTION_BEGIN("P&F2");
if(MarketID()==3) 
{
GraphXSpace = 5;
SetChartBkColor(ParamColor("BackGroundColor",  colorCustom1));

gridColor = ParamColor("GridColor", ColorRGB( 37,64,90));
SetBarsRequired(100000,100000);


symbol = Name();
ccy2= StrRight(symbol,3);
Ccy1= StrLeft(symbol,3);

decimals=IIf(ccy2 == "JPY" OR Ccy1 =="XAG",100, IIf( Ccy1 == "XAU" , 10, 10000));
format = IIf (ccy2 == "JPY"|| Ccy1 == "XAU", 8.2, 8.4);

Box = Param("Box", 10, 1, 100, 1)/decimals;

Reverse = Param("Reverse",3, 1, 5, 1);

j = 0;

Lo[0] = Box * ceil(L[0]/Box) ;
Hi[0] = Lo[0] + box;
direction = 0;

for( i = 1; i < BarCount; i++ )
{	
if(direction[j] == 0)
{
	if(L[i] <= Lo[j] - Box)
	{
		Chg = Lo[j] - L[i];
		n= floor(Chg/box);
		Lo[j] = Lo[j] - n* box;
	}
	else
	{
		if(H[i] >= Lo[j] + Reverse*Box)
		{
			Chg = H[i] - Lo[j];
			n = floor(Chg/box);
			j++;
			direction[j] = 1;
			Hi[j] = Lo[j-1] + n* Box;
			Lo[j] = Lo[j-1] + Box;
		}
	}
}
else
{
	if(H[i] >= Hi[j] + Box)
	{
		Chg = H[i] - Hi[j];
		n= floor(Chg/box);
		Hi[j] = Hi[j] + n*box;
	}
	else
	{
		if(L[i] <= Hi[j] - Reverse * Box )
		{
			Chg = Hi[j] - L[i];
			n= floor(Chg/box);
			j++;
			direction[j] = 0;
			Lo[j] = Hi[j-1] - n*box;
			Hi[j] = Hi[j-1] - Box;
			
		}
	}
}

}
delta = BarCount - j -1;
direction = Ref(direction, - delta);



Hi = Ref(Hi, -delta) + Box/2;
Lo = Ref(Lo, -delta)- Box/2;
Cl = IIf(direction == 1, Hi, Lo);
Op = IIf(direction == 1, Cl - Box, Cl + Box); 
PlotOHLC(Op, Hi, Lo, Cl,"", colorLightYellow , stylePointAndFigure|styleNoLabel);

Lastc = LastValue( C);
Last = Ref(Lastc, -(BarCount-1));
Plot( Last,"", colorRed,styleNoLine|styleDots, 0 , 0, 1);


/* Grid Construction*/
PlotGridLines = ParamToggle("PlotdGrid", "No|Yes");
if (PlotGridLines)
{
SetChartOptions(1,0, 0); 		

end = BarCount-1;
bar = BarIndex();
begin =  Status("firstvisiblebar");



	ScreenHigh =LastValue( HHV(Hi, end - begin)) + box;
	ScreenLow =LastValue( LLV(Lo, end - begin))-box;
	shift = 5;
	gLine= LineArray( begin-shift, screenlow, end, screenLow, 0, 1);
	GridMin = screenLow;
	GridMax = screenhigh;
	step = round((GridMax - GridMin )/ box);
	Plot(LineArray( begin-shift, screenhigh, end, screenhigh, 0, 1), "", gridColor, styleLine|styleNoLabel|styleNoRescale, 0, 0 ,shift);

	for (n =0; n <step ; n++)
	{
		Plot(  gLine + n*Box, "", gridColor, styleLine|styleNoLabel|styleNoRescale, 0, 0 ,shift);
		text = NumToStr( GridMin + n*Box+ 0.5*box, format);
		PlotText(text, end+2, GridMin + n*Box+ 0.25*box, colorLightYellow);
	}	
	VerticalGrid = IIf ( bar >= begin-1, IIf(frac(bar/2) ==0, screenHigh, screenLow), Null);
	Plot (VerticalGrid, "", gridColor, styleStaircase|styleNoLabel|styleNoRescale, 0,0, 1);

}
else
SetChartOptions(1,chartShowArrows|0);

Title  = 
"Interval:   " + Interval(2) + "\n" +
"Box  :      " +  Box*decimals + "  pip \n" +
"ATR :      " +NumToStr(LastValue(ATR(20) *decimals), 1.0) + "  pip";
}

else
Title = "PF with Forex Settings is not Suitable for this market";
_SECTION_END();

Featured Replies

Geschrieben

im ersten fehlt hier wohl ein Komma

 

decimals=IIf(ccy2 == "JPY" 10, 10000);

 

decimals=IIf(ccy2 == "JPY" , 10, 10000);

 

 

Verwendest Du einen Weißen Hintergrund solltest Du vielleicht auch die Farbe ändern.

Aber verstehen tue ich den dann auch nicht.

 

Beim Zweiten verstehe ich den Angezeigten Fehler auch nicht.

 

 

Dann habe ich aber hier noch einen gefunden,

aber keine Ahnung dazu weil ich mich seit Ewigkeiten nicht mehr mit P&F beschäftigt habe da ich nichts passendes in AmiBroker gefunden habe.

 

( "Point & Figure w Values adj" );

GraphXSpace = 5;

SetChartBkColor( ParamColor( "BackGroundColor", colorBlack) );

//GraphColor = ParamColor("GarphColor",colorLightGrey);

GridColor = ParamColor( "GridColor", colorLightGrey );

Scaling = ParamList( "Scaling Method", "Traditional|Percentage|AVG True Range" );

if ( scaling == "Traditional" )

Box = Param( "Box", 1, 0.2, 10, 0.1 );

else

if ( scaling == "Percentage" )

Box = Param( "Box ", 1, 0.2, 10, 0.1 ) / 100 * LastValue( C );

else

if ( scaling == "AVG True Range" )

Box = Param( "Box", 1, 0.3, 5, 0.1 ) * LastValue( ATR ( 20 ) );

shiftChart = 0;

shiftLastClose = 1;

shiftGrid = 7;

shiftPriceAxis = 2;

Reverse = Param( "Reverse", 3, 1, 5 );

j = 0;

PFL[0] = Box * ceil( Low[0] / Box ) + Box;

PFH[0] = Box * floor( High[0] / Box );

direction = 0;

for ( i = 1; i < BarCount; i++ )

{

if ( direction[j] == 0 )

{

if ( Low[i] <= PFL[j] - Box )

{

PFL[j] = Box * ceil( Low[i] / Box );

}

else

{

if ( High[i] >= PFL[j] + Reverse*Box )

{

j++;

direction[j] = 1;

PFH[j] = Box * floor( High[i] / Box );

PFL[j] = PFL[j - 1] + Box;

}

}

}

else

{

if ( High[i] >= PFH[j] + Box )

{

PFH[j] = Box * floor( High[i] / Box );

}

else

{

if ( Low[i] <= PFH[j] - Reverse * Box )

{

j++;

direction[j] = 0;

PFH[j] = PFH[j - 1] - Box;

PFL[j] = Box * ceil( Low[i] / Box );

}

}

}

}

delta = BarCount - j - 1;

direction = Ref( direction, - delta );

Hi = Ref( PFH, -delta ) + Box / 2;

Lo = Ref( PFL, -delta ) - Box / 2;

Cl = IIf( direction == 1, Hi, Lo );

Op = IIf( direction == 1, Cl - Box, Cl + Box );

Graphcolor = IIf( direction == 1, ParamColor( "X_Color", colorBrightGreen ),

ParamColor( "O_Color", colorRed ) );

PlotOHLC( Op, Hi, Lo, Cl, "", GraphColor ,

stylePointAndFigure | styleNoLabel, 0, 0 , shiftChart );

PlotOHLC( Op, Hi, Lo, Cl, "", GraphColor , stylePointAndFigure | styleNoLabel, 0, 0 , shiftChart );

Last = Ref( LastValue( C ), -( BarCount - 1 ) );

Plot( Last, "", colorRed, styleNoLine | styleDots, 0 , 0, shiftLastClose );

// selected value

Value = IIf( direction > 0, SelectedValue( Hi ) - box / 2, SelectedValue( Lo ) + box / 2 );

//----------------------------------------------------------

// GRID CONSTRUCTION

//----------------------------------------------------------

PlotGridLines = ParamToggle( "PlotdGrid", "Yes! |No", 1 ) ;

if ( PlotGridLines )

{

begin = SelectedValue( BarIndex() );

end = LastValue( BarIndex() );

period = end - begin + 1;

if ( begin < end )

{

ScreenHigh = LastValue( HHV( cl, period ) );

ScreenLow = LastValue( LLV( Cl, period ) );

top = LineArray( begin - shiftGrid, screenHigh, end, screenhigh, 0 , 1 );

Bot = LineArray( begin - shiftGrid, screenlow, end, screenLow, 0, 1 );

Plot( top, "", gridColor, styleLine | styleNoLabel , 0, 0, shiftGrid );

//Plot( bot, "", gridColor,styleLine|styleNoLabel, 0 , 0 , shiftGrid);

VerticalGrid = IIf ( BarIndex() >= begin, IIf( direction == 1, screenHigh, screenLow ), Null );

Plot ( VerticalGrid, "", gridColor, styleStaircase | styleNoLabel, 0, 0, 1 );

format = 8.2;

for ( n = LastValue( bot ); n < LastValue( top ) - 0.5*box; n = n + box )

{

Plot( bot , "", gridColor, styleLine | styleNoLabel, 0, 0 , shiftGrid );

text = NumToStr( LastValue( bot ) + 0.5 * box, format );

xposition = BarCount + shiftPriceaxis;

yPosition = LastValue( bot ) + 0.27 * box;

PlotText( text, xPosition , yPosition, colorBlue );

bot = bot + box;

Graphcolor = IIf( direction == 1, ParamColor( "X_Color", colorBrightGreen ),

ParamColor( "O_Color", colorRed ) );

PlotOHLC( Op, Hi, Lo, Cl, "", GraphColor ,

stylePointAndFigure | styleNoLabel, 0, 0 , shiftChart );

}

}

}

//----------------------------------------------------------

// TITLE

//----------------------------------------------------------

Title = "\n" +

" Instrument : " + Name() + FullName() + "\n " +

"Formula : " + " Point & Figure (High/Low Range)" + "\n " +

"Box : " + NumToStr( Box, 4.4 ) + " " +

"Reverse : " + NumToStr( Reverse, 2.0 ) + "\n " +

"ATR : " + WriteVal( LastValue( ATR( 100 ) ), format = 4.4 );

_SECTION_END();

 

 

This code by signature "apfxtrader" is the best I have noticed. It has three scaling methods Traditional|Percentage|AVG True Range.

He has also some ideas about exploration of P&F formations.

Search his signature.

 

 

Geschrieben
  • Autor

Den Komma Fehler hatte ich gestern, nachdem ich bei Google die zwei AFl Codes gefunden hatte, auch noch selbst korrigiert, hatte aber keine Lust mehr mich hier einzuloggen, auch weil ich darauf vertraute, dass noch andere schlaue Kommafinder existieren. :D

 

Beim zweiten habe ich auch keine Ahnung, was das bedeuten soll.

Danke für die dritte Variante. Die müßte man für Devisen auch noch umändern, wie es aussieht.

 

Bin selbst ansonsten kein P&F Spezialist und habe mich damit auch noch nie wirklich beschäftigt.

Geschrieben
Die müßte man für Devisen auch noch umändern, wie es aussieht.

 

 

 

 

Mit den Einstellungen bekommst Du zumindest ein Bild hin.

 

 

 

Aber ein wirklichen einfach zu handhabenden P&F Chart für AmiBroker habe ich noch nie gesehen.

post-1129-093309900 1283432125_thumb.gif

Geschrieben
  • Autor
Ah, deiner scheint ein korrigierter zu sein, weil ich hatte nur auf den Namen geachtet "Point & Figure w Values adj". Den hatte ich nämlich auch schon aus dem Netz probiert, mußte ihn aber ändern. Deiner mit dem selben Namen "Point & Figure w Values adj" funktionierte gleich.

Dein Kommentar

Du kannst jetzt schreiben und Dich später registrieren. Wenn Du ein Konto hast, melde Dich jetzt an, um unter Deinem Benutzernamen zu schreiben.

Gast
Auf dieses Thema antworten...

Account

Navigation

Suche

Suche

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.