Plotting 3 or more custom indicators in one chart using AFL code

how to add price ,rsi, and macd in one chart without drag and drop
or
how to plot many costume indicators in one chart and the chart will look like drag and drop

SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 
_SECTION_END();

_SECTION_BEGIN("rsi");
SetChartBkGradientFill( ParamColor("BgTop", colorBlack),ParamColor("BgBottom", colorLightYellow));
dynamic_color = IIf( rsi(14) > 30, colorGreen, colorRed );
Plot( rsi(14), "My rsi", dynamic_color, styleHistogram | styleThick  );

_SECTION_END();

_SECTION_BEGIN("macd");

dynamic_color = IIf( MACD() > 0, colorGreen, colorRed );
Plot( MACD(), "My MACD", dynamic_color, styleHistogram | styleThick  );


_SECTION_END()

I Find this URL

https://forum.amibroker.com/t/s-c-magazine-jan-2018-traders-tips/3875 4

but I have to use parameters to switch to the indicators ( without using parameter)
thank you

Those three charts use completely different scale. You have to use styleOwnScale if you want them to appear in single pane.
But obviously it is better to keep them in separate panes.

It is strongly recommended to READ the MANUAL
https://www.amibroker.com/guide/h_dragdrop.html

In other words, the program does not have the ability to do it
What I meant is to make separate panes automatically based on the code
Write the code and it works like drag and drop and be on one screen
I am working on a strategy with several indicators for (the explorer and plot) in one code

Your words are correct, the plots for many indicators have different scale is unprofessional if it is in one pane
But it is one screen and each indicator has its own pane

Thank you

No, you are wrong! (again?)

34

You have to add minPerc and minScale there.

1 Like

@needhelp I think that because English is not your first language many of the forum users are having difficulty understanding your questions. If your ultimate goal is to have a set of custom indicators in separate panes for your charts AND you do not want to learn how to do them programmatically (as in the example by @fxshrat above) then my humble suggestion is to learn how to use the wonderful flexibility of AmiBroker chart sheets, window layouts and templates.

https://www.amibroker.com/guide/h_sheets.html

You can insert your custom indicators as you would any other indicator in its own pane and then save your chart as a template. Then you could open any stock chart and see the same set of indicators and panes everytime. Also you could use multiple sheets with their own custom indicators in their own panes. This all would be simple and you would not have to become an "expert coder".

Good luck!

4 Likes

you are right

I will continue building my trading system .

after that i will learn to modify the code

thank you

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.