Can anyone combine these 2 afl please ?

#1
can anyone help me ? thanks
PHP:
_SECTION_BEGIN("Price");
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", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();

_SECTION_BEGIN("MA");
P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 200, 1 );
Plot( MA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style", styleLine | styleNoLabel ) | styleNoRescale );
Buy = Cross( MA( Close, 15 ), MA( Close, 45 ) );
Sell = Cross( MA( Close, 45 ), MA( Close, 15 ) );
PlotShapes(IIf(Sell==1, shapeDownArrow, shapeNone), colorYellow, 0,High, Offset=-15);
PlotShapes(IIf(Buy==1, shapeUpArrow , shapeNone), colorYellow, 0,Low, Offset=-15);
_SECTION_END();

_SECTION_BEGIN("Mid MA");
P = ParamField("Price field",-1);
Periods = Param("Periods", 45, 2, 300, 1 );
Plot( MA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style", styleLine | styleNoLabel ) | styleNoRescale );
_SECTION_END();

_SECTION_BEGIN("Long MA");
P = ParamField("Price field",-1);
Periods = Param("Periods", 100, 2, 400, 1 );
Plot( MA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style", styleLine | styleNoLabel ) | styleNoRescale );
Buy = Cross( MA( Close, 15 ), MA( Close, 100 ) );
Sell = Cross( MA( Close, 100 ), MA( Close, 15 ) );
PlotShapes(IIf(Sell==1, shapeDownArrow, shapeNone), colorCustom11, 0,High, Offset=-15);
PlotShapes(IIf(Buy==1, shapeUpArrow , shapeNone), colorCustom11, 0,Low, Offset=-15);

_SECTION_END();

_SECTION_BEGIN("MA 200");
P = ParamField("Price field",-1);
Periods = Param("Periods", 200, 2, 500, 1 );
Plot( MA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style", styleLine | styleNoLabel ) | styleNoRescale );
_SECTION_END();

_SECTION_BEGIN("BBands");
P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 100, 1 );
Width = Param("Width", 2, 0, 10, 0.05 );
Color = ParamColor("Color", colorLightGrey );
Color = ColorBlend( Color, GetChartBkColor(), 0.5 );
Style = ParamStyle("Style", styleLine | styleNoLabel ) | styleNoRescale;;
Plot( bbt = BBandTop( P, Periods, Width ), "BBTop" + _PARAM_VALUES(), Color, Style );
Plot( bbb = BBandBot( P, Periods, Width ), "BBBot" + _PARAM_VALUES(), Color, Style );
PlotOHLC( bbt, bbt, bbb, bbb, "", ColorBlend( Color, GetChartBkColor(), 0.7 ), styleNoLabel | styleCloud | styleNoRescale, Null, Null, Null, -1 );
_SECTION_END();

_SECTION_BEGIN("Volume");
Color = ParamColor("Color", ColorRGB( 128, 128, 192 ) );
Plot( Volume, _DEFAULT_NAME(), ColorBlend( Color, GetChartBkColor(), 0.5 ), styleNoTitle | ParamStyle( "Style", styleHistogram | styleOwnScale | styleThick | styleNoLabel, maskHistogram ), 2 );
_SECTION_END();

_SECTION_BEGIN("SAR");
acc = Param("Acceleration", 0.02, 0, 1, 0.001 );
accm = Param("Max. acceleration", 0.2, 0, 1, 0.001 );
Plot( SAR( acc, accm ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style", styleDots | styleNoLine, maskDefault | styleDots | styleNoLine ) );
_SECTION_END();
PHP:
_SECTION_BEGIN("day week hour all in one");
/*This will Plot monthly, weekly, daily, Hourly, 15 Minute, 5 Minute and 1 Minute charts in one chart but different panes. */
//================================================== ============================================
SetChartBkGradientFill(colorWhite,colorLightGrey,colorWhite);
Period= ParamList("Base","Monthly|Weekly|Daily|Hourly|15Mi nute|5Minute|1Minute",0);
  
if(Period=="Monthly"){
TimeFrameSet(inMonthly);
PlotOHLC(Open, High, Low, Close, "Monthly Price Chart", colorBlack, style = styleCandle | styleOwnScale);
Plot(V,"Volume",colorWhite, styleHistogram);
}
if(Period=="Weekly"){
TimeFrameSet(inWeekly);
PlotOHLC(Open, High, Low, Close, "weekly Price Chart", colorBlack, style = styleCandle | styleOwnScale);
Plot(V,"Volume",colorWhite, styleHistogram);
}
if(Period=="Daily"){
TimeFrameSet(inDaily);
PlotOHLC(Open, High, Low, Close, "Daily Price Chart", colorBlack, style = styleCandle | styleOwnScale);
Plot(V,"Volume",colorWhite, styleHistogram);
}
if(Period=="Hourly"){
TimeFrameSet(inHourly);
PlotOHLC(Open, High, Low, Close, "Hourly Price Chart", colorBlack, style = styleCandle | styleOwnScale);
Plot(V,"Volume",colorWhite, styleHistogram);
}
if(Period=="15Minute"){
TimeFrameSet(in15Minute);
PlotOHLC(Open, High, Low, Close, "15Minute Price Chart", colorBlack, style = styleCandle | styleOwnScale);
Plot(V,"Volume",colorWhite, styleHistogram);
}
if(Period=="5Minute"){
TimeFrameSet(in5Minute);
PlotOHLC(Open, High, Low, Close, "5Minute Price Chart", colorBlack, style = styleCandle | styleOwnScale);
Plot(V,"Volume",colorWhite, styleHistogram);
}
if(Period=="1Minute"){
TimeFrameSet(in1Minute);
PlotOHLC(Open, High, Low, Close, "1Minute Price Chart", colorBlack, style = styleCandle | styleOwnScale);
Plot(V,"Volume",colorWhite, styleHistogram);
}
_SECTION_END();
 

KelvinHand

Well-Known Member
#2
can anyone help me ? thanks
PHP:
_SECTION_BEGIN("Price");
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", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();

_SECTION_BEGIN("MA");
P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 200, 1 );
Plot( MA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style", styleLine | styleNoLabel ) | styleNoRescale );
Buy = Cross( MA( Close, 15 ), MA( Close, 45 ) );
Sell = Cross( MA( Close, 45 ), MA( Close, 15 ) );
PlotShapes(IIf(Sell==1, shapeDownArrow, shapeNone), colorYellow, 0,High, Offset=-15);
PlotShapes(IIf(Buy==1, shapeUpArrow , shapeNone), colorYellow, 0,Low, Offset=-15);
_SECTION_END();

_SECTION_BEGIN("Mid MA");
P = ParamField("Price field",-1);
Periods = Param("Periods", 45, 2, 300, 1 );
Plot( MA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style", styleLine | styleNoLabel ) | styleNoRescale );
_SECTION_END();

_SECTION_BEGIN("Long MA");
P = ParamField("Price field",-1);
Periods = Param("Periods", 100, 2, 400, 1 );
Plot( MA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style", styleLine | styleNoLabel ) | styleNoRescale );
Buy = Cross( MA( Close, 15 ), MA( Close, 100 ) );
Sell = Cross( MA( Close, 100 ), MA( Close, 15 ) );
PlotShapes(IIf(Sell==1, shapeDownArrow, shapeNone), colorCustom11, 0,High, Offset=-15);
PlotShapes(IIf(Buy==1, shapeUpArrow , shapeNone), colorCustom11, 0,Low, Offset=-15);

_SECTION_END();

_SECTION_BEGIN("MA 200");
P = ParamField("Price field",-1);
Periods = Param("Periods", 200, 2, 500, 1 );
Plot( MA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style", styleLine | styleNoLabel ) | styleNoRescale );
_SECTION_END();

_SECTION_BEGIN("BBands");
P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 100, 1 );
Width = Param("Width", 2, 0, 10, 0.05 );
Color = ParamColor("Color", colorLightGrey );
Color = ColorBlend( Color, GetChartBkColor(), 0.5 );
Style = ParamStyle("Style", styleLine | styleNoLabel ) | styleNoRescale;;
Plot( bbt = BBandTop( P, Periods, Width ), "BBTop" + _PARAM_VALUES(), Color, Style );
Plot( bbb = BBandBot( P, Periods, Width ), "BBBot" + _PARAM_VALUES(), Color, Style );
PlotOHLC( bbt, bbt, bbb, bbb, "", ColorBlend( Color, GetChartBkColor(), 0.7 ), styleNoLabel | styleCloud | styleNoRescale, Null, Null, Null, -1 );
_SECTION_END();

_SECTION_BEGIN("Volume");
Color = ParamColor("Color", ColorRGB( 128, 128, 192 ) );
Plot( Volume, _DEFAULT_NAME(), ColorBlend( Color, GetChartBkColor(), 0.5 ), styleNoTitle | ParamStyle( "Style", styleHistogram | styleOwnScale | styleThick | styleNoLabel, maskHistogram ), 2 );
_SECTION_END();

_SECTION_BEGIN("SAR");
acc = Param("Acceleration", 0.02, 0, 1, 0.001 );
accm = Param("Max. acceleration", 0.2, 0, 1, 0.001 );
Plot( SAR( acc, accm ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style", styleDots | styleNoLine, maskDefault | styleDots | styleNoLine ) );
_SECTION_END();
PHP:
_SECTION_BEGIN("day week hour all in one");
/*This will Plot monthly, weekly, daily, Hourly, 15 Minute, 5 Minute and 1 Minute charts in one chart but different panes. */
//================================================== ============================================
SetChartBkGradientFill(colorWhite,colorLightGrey,colorWhite);
Period= ParamList("Base","Monthly|Weekly|Daily|Hourly|15Mi nute|5Minute|1Minute",0);
  
if(Period=="Monthly"){
TimeFrameSet(inMonthly);
PlotOHLC(Open, High, Low, Close, "Monthly Price Chart", colorBlack, style = styleCandle | styleOwnScale);
Plot(V,"Volume",colorWhite, styleHistogram);
}
if(Period=="Weekly"){
TimeFrameSet(inWeekly);
PlotOHLC(Open, High, Low, Close, "weekly Price Chart", colorBlack, style = styleCandle | styleOwnScale);
Plot(V,"Volume",colorWhite, styleHistogram);
}
if(Period=="Daily"){
TimeFrameSet(inDaily);
PlotOHLC(Open, High, Low, Close, "Daily Price Chart", colorBlack, style = styleCandle | styleOwnScale);
Plot(V,"Volume",colorWhite, styleHistogram);
}
if(Period=="Hourly"){
TimeFrameSet(inHourly);
PlotOHLC(Open, High, Low, Close, "Hourly Price Chart", colorBlack, style = styleCandle | styleOwnScale);
Plot(V,"Volume",colorWhite, styleHistogram);
}
if(Period=="15Minute"){
TimeFrameSet(in15Minute);
PlotOHLC(Open, High, Low, Close, "15Minute Price Chart", colorBlack, style = styleCandle | styleOwnScale);
Plot(V,"Volume",colorWhite, styleHistogram);
}
if(Period=="5Minute"){
TimeFrameSet(in5Minute);
PlotOHLC(Open, High, Low, Close, "5Minute Price Chart", colorBlack, style = styleCandle | styleOwnScale);
Plot(V,"Volume",colorWhite, styleHistogram);
}
if(Period=="1Minute"){
TimeFrameSet(in1Minute);
PlotOHLC(Open, High, Low, Close, "1Minute Price Chart", colorBlack, style = styleCandle | styleOwnScale);
Plot(V,"Volume",colorWhite, styleHistogram);
}
_SECTION_END();
Since you can put 2 afls code in
PHP:
..
so easily.
Why can't you combine both and test out youself first. Encounter problem
then call for help.
 

mastermind007

Well-Known Member
#5
Both of the AFLs posted above are completely disjoint of one another and hence if anyone wanted to combine them, they would need to be placed in same pane one below another.

If, after pasting the AFL, the chart starts to look crazy or gets squinted, start commenting out the Plot statements from bottom and move towards top.
 
#6
Both of the AFLs posted above are completely disjoint of one another and hence if anyone wanted to combine them, they would need to be placed in same pane one below another.

If, after pasting the AFL, the chart starts to look crazy or gets squinted, start commenting out the Plot statements from bottom and move towards top.
The problem is I never learn coding before , easy with you guys but impossible to me , so guys if who can help me please please please do it , dont talk , thank you :(
 

KelvinHand

Well-Known Member
#7
The problem is I never learn coding before , easy with you guys but impossible to me , so guys if who can help me please please please do it , dont talk , thank you :(

We never bother you know the coding or not, the problem of you is never describe what the cause of the problem that you are facing that matter.

Post #1, you just say "can anyone help me ?"
You don't bother to explain further - why you need help, since you place the code separately so neatly. So Post #2 & post #3 asked.

As a code expert, we try to solve problem, but not your servant and not paid by you, don't had the duty to do the whole work for you.

Post #4, Now we know you try, but we don't know what is not working, no error messages give by you, no describing of "not working" by u.

Post #5, MasterMind our top code expert, come down to chat with you, pointed out the syndrome.


Now you command us, like you are the BOSS here - "Please do it , dont talk"

So rude of you. don't do a proper communication. How the feel of the Code Experts

"Do it" as you wish, "Dont Talk".
 
Last edited:
#8
We never bother you know the coding or not, the problem of you is never describe what the cause of the problem that you are facing that matter.

Post #1, you just say "can anyone help me ?"
You don't bother to explain further - why you need help, since you place the code separately so neatly. So Post #2 & post #3 asked.

As a programmer, we try to solve problem, but not your servant and not paid by you, don't had the duty to do the whole work for you.

Post #4, Now we know you try, but we don't know what is not working, no error messages give by you, no describing of "not working" by u.

Post #5, MasterMind the expert, our top programmer come down to chat with you, pointed out the syndrome.


Now you command us, like you are the BOSS here - "Please do it , dont talk"

So rude of you. don't do a proper communication. How the feel of the Code Experts

"Do it" as you wish, "Dont Talk".
my bad , sorry for that , but what should i explain ? did you ever tried to combine them in one pane or not ? if you did it you will know what is wrong in there , its not showing boillinger bands , moving average .. etc

sorry about that again
 

AFL

New Member
#9
kindly help me in inserting this momentum indicator in amibroker 5 min chart

kindly help me in inserting this momentum indicator in amibroker 5 min chart

LookBack = Param("Lookback", 13, 2, 100 );
Smooth1 = Param("Smooth 1", 25, 1, 100 );
Smooth2 = Param("Smooth 2", 2, 1, 100 );

HH = HHV( H, LookBack );
LL = LLV( L, LookBack );

StoMom = 100 * EMA( EMA( C - 0.5 * ( HH + LL ), Smooth1 ), Smooth2 ) /
( 0.5 * EMA( EMA( HH - LL, Smooth1 ), Smooth2 ) );

Plot(StoMom, _DEFAULT_NAME(), ParamColor("Color", ColorCycle ) );
 

Similar threads