Simple Coding Help - No Promise.

amitrandive

Well-Known Member
Dear all seniors,

need help to develop exploration of Chikaoo span breakout.

Condition -

Need stocks which gives breakouts when chikoo span moves up with price... Pls check the chart.

Thanx you in advance
Found on the net

Code:
_SECTION_BEGIN("LETSGROW");
SetChartOptions(0,chartShowArrows|chartShowDates);
 _N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) Vol " +WriteVal( V, 1.0 ) +" {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 )) ));
 //Plot( C, "Close", ParamColor("Color", colorWhite ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
 Plot(C,"",colorRose, styleCandle );
 if( ParamToggle("Tooltip shows", "All Values|Only Prices" ) )
 {
 ToolTip=StrFormat("Open: %g\nHigh: %g\nLow: %g\nClose: %g (%.1f%%)\nVolume: "+NumToStr( V, 1 ), O, H, L, C, SelectedValue( ROC( C, 1 )));
 }


 SL = ( HHV( H, 26 ) + LLV( L, 26) )/2; // standard, base, or kijun-sen line
 TL = ( HHV( H, 9 ) + LLV( L, 9 ) )/2; // turning, conversion, or tenkan-sen line
 DL = Ref( C, 26 ); // delayed close price, or chikou span
 Span1 = Ref( ( SL + TL )/2, -25 ); //Span1 and Span2 define the clouds
 Span2 = Ref( (HHV( H, 52) + LLV(L, 52))/2, -25);
 /*
 SL = ( HHV( H, 26 ) + LLV( L, 26) )/2;
 TL = ( HHV( H, 9 ) + LLV( L, 9 ) )/2;
 DL = Ref( C, 26 );
 Span1 = (( SL + TL )/2);
 Span2 = (HHV( H, 52) + LLV(L, 52))/2;
 */
 hue = Param("Hue",140,0,255,1);
 sat = Param("Sat",100,0,255,1);
 bri = Param("bri",220,0,255,1);

 Plot(SL,"SL",colorBlue,styleThick); // standard, base, or kijun-sen line
 Plot(TL,"TL",colorRed,styleThick); // turning, conversion, or tenkan-sen line
 Plot(DL,"DL",colorLime ,styleThick); // delayed, lagging, or chikou span
 //Plot(Span1,"",colorGreen,1,0,0,26); // senkou span A, kumo, or white clouds
 //Plot(Span2,"",colorSeaGreen,1,0,0,26); // senkou span B, kumo, or white clouds
//PlotOHLC(Span1,Span1,Span2,Span2,"Cloud",ColorHSB( Hue,sat,bri),styleCloud);
 //PlotOHLC(Span1,Span2,Span1,Span2,"",IIf(Span1>Span 2,8,9),styleCloud|4096,0,0,26);

Span1 = Ref( ( SL + TL )/2, -25 );		//Span1 and Span2 define the clouds
Span21 = Ref( (HHV( H, 52) + LLV(L, 52))/2, -25);

SR=Span1-Span21;
Span2=Span1-0.05*SR;
Span3=Span1-0.1*SR;
Span4=Span1-0.15*SR;
Span5=Span1-0.2*SR;
Span6=Span1-0.25*SR;
Span7=Span1-0.3*SR;
Span8=Span1-0.35*SR;
Span9=Span1-0.4*SR;
Span10=Span1-0.45*SR;
Span11=Span1-0.5*SR;
Span12=Span1-0.55*SR;
Span13=Span1-0.6*SR;
Span14=Span1-0.65*SR;
Span15=Span1-0.7*SR;
Span16=Span1-0.75*SR;
Span17=Span1-0.8*SR;
Span18=Span1-0.85*SR;
Span19=Span1-0.9*SR;
Span20=Span1-0.95*SR;

ColorKumo=IIf(C>Span1,ColorRGB(10,100,40),IIf(C<Span2,ColorRGB(100,10,40),colorGrey40));



Plot(Span1,"",ColorKumo,styleDashed|styleNoLabel);
Plot(Span2,"",ColorKumo,styleDashed |styleNoLabel);
Plot(Span3,"",ColorKumo,styleDashed|styleNoLabel);
Plot(Span4,"",ColorKumo,styleDashed|styleNoLabel);
Plot(Span5,"",ColorKumo,styleDashed|styleNoLabel);
Plot(Span6,"",ColorKumo,styleDashed|styleNoLabel);
Plot(Span7,"",ColorKumo,styleDashed|styleNoLabel);
Plot(Span8,"",ColorKumo,styleDashed|styleNoLabel);
Plot(Span9,"",ColorKumo,styleDashed|styleNoLabel);
Plot(Span10,"",ColorKumo,styleDashed|styleNoLabel);
Plot(Span11,"",ColorKumo,styleDashed|styleNoLabel);
Plot(Span12,"",ColorKumo,styleDashed|styleNoLabel);
Plot(Span13,"",ColorKumo,styleDashed|styleNoLabel);
Plot(Span14,"",ColorKumo,styleDashed|styleNoLabel);
Plot(Span15,"",ColorKumo,styleDashed|styleNoLabel);
Plot(Span16,"",ColorKumo,styleDashed|styleNoLabel);
Plot(Span17,"",ColorKumo,styleDashed|styleNoLabel);
Plot(Span18,"",ColorKumo,styleDashed|styleNoLabel);
Plot(Span19,"",ColorKumo,styleDashed|styleNoLabel);
Plot(Span20,"",ColorKumo,styleDashed|styleNoLabel);
Plot(Span21,"",ColorKumo,styleDashed|styleNoLabel);



































 Buy = Cross(TL,SL);
 Sell = Cross(SL,TL);
 shape=Buy*shapeUpArrow + Sell*shapeDownArrow;
 PlotShapes(shape,IIf(Buy,colorDarkGreen,colorRed), 0,IIf(Buy,Low,High));

 above = IIf(TL>Span1 AND TL>Span2,1,0);
 within = IIf(TL>Span1 AND TL<Span2,1,0);
 below = IIf(TL<Span1 AND TL<Span2,1,0);
 Buy = Cross(TL,SL) AND (DL>Close);
 Sell = Cross(SL,TL) AND (DL<SL);
 StrongBuy = Buy AND above;
 MediumBuy = Buy AND within;
 WeakBuy = Buy AND below;
 StrongSell = Sell AND below;
 MediumSell = Sell AND within;
 WeakSell = Sell AND above;
//////////////////////////////////////////////////code addition ////////////////////////////////////////////////////////////// 

GraphXSpace = 5; 
dist = 4.5*ATR(10);  
 
//for( i = 0; i < BarCount; i++ )  
//{if( Buy[i] ) PlotText( "Buy\n@" + C[ i ], i, L[ i ]-dist[i], colorGreen );  
//if( Sell[i] ) PlotText( "sell\n@" + C[ i ], i, H[ i ]+dist[i], colorRed); }


 
for( i = 0; i < BarCount; i++)  
{  
if( StrongBuy[i] ) 
PlotText( "StrongBuy\n@" +C[ i ], i, L[ i ]-dist[i], colorBrightGreen );
if( MediumBuy[i] ) 
PlotText( "MediumBuy" + C[ i ], i, L[ i ]-dist[i], ColorRGB(0,100,0) );
if( WeakBuy[i] ) 
PlotText( "WeakBuy" + C[ i ], i, L[ i ]-dist[i], ColorRGB(0,50,0) );



  
if( StrongSell[i] ) PlotText( "Strongsell\n@" + C[ i ], i, H[ i ]+dist[i], ColorRGB(300,0,0));
if( MediumSell[i] ) PlotText( "Mediumsell\n@" + C[ i ], i, H[ i ]+dist[i], ColorRGB(150,0,0)); 
if( WeakSell[i] ) PlotText( "Weaksell\n@" + C[ i ], i, H[ i ]+dist[i], ColorRGB(50,0,0));   
} 






PlotShapes(StrongBuy*shapeUpTriangle,colorBrightGreen, 0, Low, Offset =-10);
//PlotShapes(StrongBuy*shapeDigit1,colorBrightGreen, 0, Low, Offset =-25);
PlotShapes(MediumBuy*shapeHollowUpTriangle,colorBrightGreen, 0, Low, Offset =0);
//PlotShapes(MediumBuy*shapeDigit2,colorBrightGreen, 0, Low, Offset =-15);
PlotShapes(WeakBuy*shapeHollowUpTriangle,colorGreen, 0, Low, Offset =-15);
//PlotShapes(WeakBuy*shapeDigit3,colorGreen, 0, Low, Offset =-30);


PlotShapes(StrongSell*shapeDownTriangle,colorRed, 0, High, Offset =-40);
//PlotShapes(StrongSell*shapeDigit1,colorRed, 0, High, Offset =55);
PlotShapes(MediumSell*shapeHollowDownTriangle,colorRed, 0, High, Offset =-40);
//PlotShapes(MediumSell*shapeDigit2,colorRed, 0, High, Offset =55);
PlotShapes(WeakSell*shapeHollowDownTriangle,colorRed, 0, High, Offset =-40);
//PlotShapes(WeakSell*shapeDigit3,colorRed, 0, High, Offset =55);


/////////////////////////////////////////////////////////exploration ////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
Filter=Buy OR Sell OR StrongBuy OR MediumBuy OR WeakBuy OR StrongSell OR MediumSell OR WeakSell;
AddColumn( IIf(Buy,C,IIf(Sell,-C,Null)) ,"bs",1.0,colorWhite,IIf(Buy,colorBrightGreen,IIf(Sell,colorRed,colorBlack)));
AddColumn( IIf(StrongBuy,C,IIf(StrongSell,-C,Null)) ,"STRONG",1.0,colorWhite,IIf(StrongBuy,colorBrightGreen,IIf(StrongSell,colorRed,colorBlack))); 
AddColumn( IIf(MediumBuy,C,IIf(MediumSell,-C,Null)) ,"MEDIUM",1.0,colorWhite,IIf(MediumBuy,colorGreen,IIf(MediumSell,colorDarkRed,colorBlack))); 
AddColumn( IIf(WeakBuy,C,IIf(WeakSell,-C,Null)) ,"WEAK",1.0,colorWhite,IIf(WeakBuy,colorGreen,IIf(WeakSell,colorDarkRed,colorBlack))); 

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 

 IIf( (StrongBuy),PlotShapes(shapeUpTriangle*StrongBuy,colorGreen),0); // I want to show msg Strong Buy @ (price) Here wit Arrow
 IIf( (MediumBuy),PlotShapes(shapeUpArrow*MediumBuy,colorGreen),0); // I want to show msg Medium Buy @ (price) Here wit Arrow
 IIf( (WeakBuy),PlotShapes(shapeHollowUpArrow*WeakBuy,colorIndigo),0); // I want to show msg Weak Buy @ (price) Here wit Arrow
 IIf( (StrongSell),PlotShapes(shapeDownTriangle*StrongSell,colorRed),0);// I want to show msg Strong Sell @ (price) Here wit Arrow
 IIf( (MediumSell),PlotShapes(shapeDownArrow*MediumSell,colorRed),0); // I want to show msg Medium Sell @ (price)Here wit Arrow
_SECTION_END();
Try this also

http://www.amibroker.com/library/detail.php?id=1431
 
Last edited:
Found on the net

Code:
_SECTION_BEGIN("LETSGROW");
SetChartOptions(0,chartShowArrows|chartShowDates);
 _N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) Vol " +WriteVal( V, 1.0 ) +" {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 )) ));
 //Plot( C, "Close", ParamColor("Color", colorWhite ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
 Plot(C,"",colorRose, styleCandle );
 if( ParamToggle("Tooltip shows", "All Values|Only Prices" ) )
 {
 ToolTip=StrFormat("Open: %g\nHigh: %g\nLow: %g\nClose: %g (%.1f%%)\nVolume: "+NumToStr( V, 1 ), O, H, L, C, SelectedValue( ROC( C, 1 )));
 }


 SL = ( HHV( H, 26 ) + LLV( L, 26) )/2; // standard, base, or kijun-sen line
 TL = ( HHV( H, 9 ) + LLV( L, 9 ) )/2; // turning, conversion, or tenkan-sen line
 DL = Ref( C, 26 ); // delayed close price, or chikou span
 Span1 = Ref( ( SL + TL )/2, -25 ); //Span1 and Span2 define the clouds
 Span2 = Ref( (HHV( H, 52) + LLV(L, 52))/2, -25);
 /*
 SL = ( HHV( H, 26 ) + LLV( L, 26) )/2;
 TL = ( HHV( H, 9 ) + LLV( L, 9 ) )/2;
 DL = Ref( C, 26 );
 Span1 = (( SL + TL )/2);
 Span2 = (HHV( H, 52) + LLV(L, 52))/2;
 */
 hue = Param("Hue",140,0,255,1);
 sat = Param("Sat",100,0,255,1);
 bri = Param("bri",220,0,255,1);

 Plot(SL,"SL",colorBlue,styleThick); // standard, base, or kijun-sen line
 Plot(TL,"TL",colorRed,styleThick); // turning, conversion, or tenkan-sen line
 Plot(DL,"DL",colorLime ,styleThick); // delayed, lagging, or chikou span
 //Plot(Span1,"",colorGreen,1,0,0,26); // senkou span A, kumo, or white clouds
 //Plot(Span2,"",colorSeaGreen,1,0,0,26); // senkou span B, kumo, or white clouds
//PlotOHLC(Span1,Span1,Span2,Span2,"Cloud",ColorHSB( Hue,sat,bri),styleCloud);
 //PlotOHLC(Span1,Span2,Span1,Span2,"",IIf(Span1>Span 2,8,9),styleCloud|4096,0,0,26);

Span1 = Ref( ( SL + TL )/2, -25 );		//Span1 and Span2 define the clouds
Span21 = Ref( (HHV( H, 52) + LLV(L, 52))/2, -25);

SR=Span1-Span21;
Span2=Span1-0.05*SR;
Span3=Span1-0.1*SR;
Span4=Span1-0.15*SR;
Span5=Span1-0.2*SR;
Span6=Span1-0.25*SR;
Span7=Span1-0.3*SR;
Span8=Span1-0.35*SR;
Span9=Span1-0.4*SR;
Span10=Span1-0.45*SR;
Span11=Span1-0.5*SR;
Span12=Span1-0.55*SR;
Span13=Span1-0.6*SR;
Span14=Span1-0.65*SR;
Span15=Span1-0.7*SR;
Span16=Span1-0.75*SR;
Span17=Span1-0.8*SR;
Span18=Span1-0.85*SR;
Span19=Span1-0.9*SR;
Span20=Span1-0.95*SR;

ColorKumo=IIf(C>Span1,ColorRGB(10,100,40),IIf(C<Span2,ColorRGB(100,10,40),colorGrey40));



Plot(Span1,"",ColorKumo,styleDashed|styleNoLabel);
Plot(Span2,"",ColorKumo,styleDashed |styleNoLabel);
Plot(Span3,"",ColorKumo,styleDashed|styleNoLabel);
Plot(Span4,"",ColorKumo,styleDashed|styleNoLabel);
Plot(Span5,"",ColorKumo,styleDashed|styleNoLabel);
Plot(Span6,"",ColorKumo,styleDashed|styleNoLabel);
Plot(Span7,"",ColorKumo,styleDashed|styleNoLabel);
Plot(Span8,"",ColorKumo,styleDashed|styleNoLabel);
Plot(Span9,"",ColorKumo,styleDashed|styleNoLabel);
Plot(Span10,"",ColorKumo,styleDashed|styleNoLabel);
Plot(Span11,"",ColorKumo,styleDashed|styleNoLabel);
Plot(Span12,"",ColorKumo,styleDashed|styleNoLabel);
Plot(Span13,"",ColorKumo,styleDashed|styleNoLabel);
Plot(Span14,"",ColorKumo,styleDashed|styleNoLabel);
Plot(Span15,"",ColorKumo,styleDashed|styleNoLabel);
Plot(Span16,"",ColorKumo,styleDashed|styleNoLabel);
Plot(Span17,"",ColorKumo,styleDashed|styleNoLabel);
Plot(Span18,"",ColorKumo,styleDashed|styleNoLabel);
Plot(Span19,"",ColorKumo,styleDashed|styleNoLabel);
Plot(Span20,"",ColorKumo,styleDashed|styleNoLabel);
Plot(Span21,"",ColorKumo,styleDashed|styleNoLabel);



































 Buy = Cross(TL,SL);
 Sell = Cross(SL,TL);
 shape=Buy*shapeUpArrow + Sell*shapeDownArrow;
 PlotShapes(shape,IIf(Buy,colorDarkGreen,colorRed), 0,IIf(Buy,Low,High));

 above = IIf(TL>Span1 AND TL>Span2,1,0);
 within = IIf(TL>Span1 AND TL<Span2,1,0);
 below = IIf(TL<Span1 AND TL<Span2,1,0);
 Buy = Cross(TL,SL) AND (DL>Close);
 Sell = Cross(SL,TL) AND (DL<SL);
 StrongBuy = Buy AND above;
 MediumBuy = Buy AND within;
 WeakBuy = Buy AND below;
 StrongSell = Sell AND below;
 MediumSell = Sell AND within;
 WeakSell = Sell AND above;
//////////////////////////////////////////////////code addition ////////////////////////////////////////////////////////////// 

GraphXSpace = 5; 
dist = 4.5*ATR(10);  
 
//for( i = 0; i < BarCount; i++ )  
//{if( Buy[i] ) PlotText( "Buy\n@" + C[ i ], i, L[ i ]-dist[i], colorGreen );  
//if( Sell[i] ) PlotText( "sell\n@" + C[ i ], i, H[ i ]+dist[i], colorRed); }


 
for( i = 0; i < BarCount; i++)  
{  
if( StrongBuy[i] ) 
PlotText( "StrongBuy\n@" +C[ i ], i, L[ i ]-dist[i], colorBrightGreen );
if( MediumBuy[i] ) 
PlotText( "MediumBuy" + C[ i ], i, L[ i ]-dist[i], ColorRGB(0,100,0) );
if( WeakBuy[i] ) 
PlotText( "WeakBuy" + C[ i ], i, L[ i ]-dist[i], ColorRGB(0,50,0) );



  
if( StrongSell[i] ) PlotText( "Strongsell\n@" + C[ i ], i, H[ i ]+dist[i], ColorRGB(300,0,0));
if( MediumSell[i] ) PlotText( "Mediumsell\n@" + C[ i ], i, H[ i ]+dist[i], ColorRGB(150,0,0)); 
if( WeakSell[i] ) PlotText( "Weaksell\n@" + C[ i ], i, H[ i ]+dist[i], ColorRGB(50,0,0));   
} 






PlotShapes(StrongBuy*shapeUpTriangle,colorBrightGreen, 0, Low, Offset =-10);
//PlotShapes(StrongBuy*shapeDigit1,colorBrightGreen, 0, Low, Offset =-25);
PlotShapes(MediumBuy*shapeHollowUpTriangle,colorBrightGreen, 0, Low, Offset =0);
//PlotShapes(MediumBuy*shapeDigit2,colorBrightGreen, 0, Low, Offset =-15);
PlotShapes(WeakBuy*shapeHollowUpTriangle,colorGreen, 0, Low, Offset =-15);
//PlotShapes(WeakBuy*shapeDigit3,colorGreen, 0, Low, Offset =-30);


PlotShapes(StrongSell*shapeDownTriangle,colorRed, 0, High, Offset =-40);
//PlotShapes(StrongSell*shapeDigit1,colorRed, 0, High, Offset =55);
PlotShapes(MediumSell*shapeHollowDownTriangle,colorRed, 0, High, Offset =-40);
//PlotShapes(MediumSell*shapeDigit2,colorRed, 0, High, Offset =55);
PlotShapes(WeakSell*shapeHollowDownTriangle,colorRed, 0, High, Offset =-40);
//PlotShapes(WeakSell*shapeDigit3,colorRed, 0, High, Offset =55);


/////////////////////////////////////////////////////////exploration ////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
Filter=Buy OR Sell OR StrongBuy OR MediumBuy OR WeakBuy OR StrongSell OR MediumSell OR WeakSell;
AddColumn( IIf(Buy,C,IIf(Sell,-C,Null)) ,"bs",1.0,colorWhite,IIf(Buy,colorBrightGreen,IIf(Sell,colorRed,colorBlack)));
AddColumn( IIf(StrongBuy,C,IIf(StrongSell,-C,Null)) ,"STRONG",1.0,colorWhite,IIf(StrongBuy,colorBrightGreen,IIf(StrongSell,colorRed,colorBlack))); 
AddColumn( IIf(MediumBuy,C,IIf(MediumSell,-C,Null)) ,"MEDIUM",1.0,colorWhite,IIf(MediumBuy,colorGreen,IIf(MediumSell,colorDarkRed,colorBlack))); 
AddColumn( IIf(WeakBuy,C,IIf(WeakSell,-C,Null)) ,"WEAK",1.0,colorWhite,IIf(WeakBuy,colorGreen,IIf(WeakSell,colorDarkRed,colorBlack))); 

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 

 IIf( (StrongBuy),PlotShapes(shapeUpTriangle*StrongBuy,colorGreen),0); // I want to show msg Strong Buy @ (price) Here wit Arrow
 IIf( (MediumBuy),PlotShapes(shapeUpArrow*MediumBuy,colorGreen),0); // I want to show msg Medium Buy @ (price) Here wit Arrow
 IIf( (WeakBuy),PlotShapes(shapeHollowUpArrow*WeakBuy,colorIndigo),0); // I want to show msg Weak Buy @ (price) Here wit Arrow
 IIf( (StrongSell),PlotShapes(shapeDownTriangle*StrongSell,colorRed),0);// I want to show msg Strong Sell @ (price) Here wit Arrow
 IIf( (MediumSell),PlotShapes(shapeDownArrow*MediumSell,colorRed),0); // I want to show msg Medium Sell @ (price)Here wit Arrow
_SECTION_END();
Try this also

http://www.amibroker.com/library/detail.php?id=1431

thanxs for the efforts but its not wt i need amit dear.

When chikoo is breaking with price... its my need.

waiting for reply
 
Dear seniors,

i want one exploration code pls help me to do this

condition 1= in daily 50 ma rising or falling
condition2 = in 5 min 50 ma rising or falling
condition 3 = macd()>0 or below 0

i tried to write below code but not getting sucess pls help me to do this

_SECTION_BEGIN("Formula 175");
TimeFrameSet(inDaily);
ad=MA(C,50);
adstat=WriteIf(ad>Ref(ad,-1),"rising","falling");
adcol=IIf(ad>Ref(ad,-1),colorGreen,colorRed);
TimeFrameRestore();

a=MA(C,50);
a5=a>Ref(a,-1);
a5stat=WriteIf(a>Ref(a,-1),"rising","falling");
a5col=IIf(a>Ref(a,-1),colorGreen,colorRed);
//Buy=MACD()>0;
//Sell=MACD()<0;
buystat=WriteIf(MACD()>0,"BUY","SELL");
Filter=1;
AddTextColumn(adstat,"daily",1,colorDefault,adcol);
AddTextColumn(a5stat,"5min",1,colorblack,a5col);
AddTextColumn(buystat,"b/s",1,colorDefault,colordefault);
_SECTION_END();

Abhishek
 
thanxs for the efforts but its not wt i need amit dear.

When chikoo is breaking with price... its my need.

waiting for reply
Dear all seniors,

need help to develop exploration of Chikaoo span breakout.

Condition -

Need stocks which gives breakouts when chikoo span moves up with price... Pls check the chart.

Thanx you in advance
Hi
I dont know how much you know about Ichimoku. But I feel you have some misconception about Chikou Span and its relation with price.
The two are same (price wise) and only difference is that Chikou is the current price plotted 26 periods backwards. So if there is a BO in price then there will be a BO in Chikou also.
I hope this clears the misconception.
 

sr114

Well-Known Member
Abhishek

the corrected afl is here. [ prior afl will not work properly]

[Note : Abhishek - if u want to get MA 50 in daily using the intraday data, u must have more than 50 days of data for proper exploration.]

TimeFrameSet( in5Minute );
ma50_5 = MA( C, 50 );
TimeFrameRestore();

TimeFrameSet( inDaily );
ma50_d = MA( C, 50 );
TimeFrameRestore();


Plot(C,"Close",colorGreen,stylebar);
Plot(TimeFrameExpand(ma50_5,in5Minute),"\nMA_5",colorblue,styleLine);
PlotTimeFrameExpand(ma50_d,inDaily),"\nMA_d",colorred,styleLine);

Filter=1;
AddColumn(TimeFrameExpand(ma50_5,in5Minute), "5 min MA", 1.2,colorblue);
AddColumn(IIf(TimeFrameExpand(ma50_5,in5Minute),1,Null), "in 5 min", 1,colorwhite,
IIf(TimeFrameExpand(ma50_5,in5Minute)>Ref(TimeFrameExpand(ma50_5,in5Minute),-1),colorGreen,
IIf(TimeFrameExpand(ma50_5,in5Minute)<Ref(TimeFrameExpand(ma50_5,in5Minute),-1),colorred,colorwhite)));


AddColumn(TimeFrameExpand(ma50_d,inDaily), "Daily MA", 1.2,colorblue);
AddColumn(IIf(TimeFrameExpand(ma50_d,inDaily),1,Null), " In Daily MA", 1,colorwhite,
IIf(TimeFrameExpand(ma50_d,inDaily)>Ref(TimeFrameExpand(ma50_d,inDaily),-1),colorGreen,
IIf(TimeFrameExpand(ma50_d,inDaily)<Ref(TimeFrameExpand(ma50_d,inDaily),-1),colorred,
IIf(TimeFrameExpand(ma50_d,inDaily)==Ref(TimeFrameExpand(ma50_d,inDaily),-1),colorwhite,Null))));


AddColumn( MACD(), "MACD", 1.2 , IIf( MACD() > 0, colorGreen, colorRed ) );
 
Last edited:
Hi all,

I'm trying to export the exploration results to text file. I found something on this topic. The following code is trying to export results to a text file; but the output file is blank. I would really appreciate if any AFL expert can fix this.

// create folder for exporting purposes
fmkdir( "C:\\DataExport\\" );

// open file for writing
fh = fopen( "c:\\DataExport\\explore.txt", "w" );

if( fh )
{
// sample exploration code
Filter = ROC( Close, 1 ) > 3 AND Volume > 1000000;

if ( LastValue( Cum( Filter ))) //check if filter has contents
fputs( "", fh ); // write ticker name

fclose( fh ); //close file
}
 

Similar threads