Can AFL on Price chart, INSERT a new chart and Plot to it?

Before I start… I read this and it is not what I want to do:


  1. Run my AFL (with IB connection and autotrading) on the PRICE chart - this calculates all my indicators/variables for me based on my parameters I set on the overall AFL.
  2. From the AFL running on the price chart, I want to INSERT a blank chart, and then plot my variables on that chart UNDER the price chart and sync’d to the price chart for time/range bars.

Can you do this? I searched this forum and I read the manual and don’t see any functions to do this.

I DON’T want to run the same code on a separate chart and switch based on ChartType like this

ChartType = ParamList("Chart Type", "Price Chart|Indicator"); //

if (ChartType == "Price Chart") // Price Chart

if (ChartType == "Indicator") // 
Plot(a1, "MyIndicator1", colorRed, styleThick );
Plot(a2, "MyIndicator2", colorGreen, styleThick );

Thanks in advance !

  1. Do all calculations in step one and save the results you need in static variables
  2. insert a new panel, read the static variables you saved in step 1 and plot your indicators
1 Like

Yep, good advice. That would certainly work, and keep all the code in the orginal AFL.

Thank you !

Hi guys,

I need to plot many signals for reviewing them over a strategy, so to place them sharply on the chart, i created StaticVars for every one on the Main strategy and call them from others AFL's just to plot below the chart, everyone on a separate panel as you reccomended on this thread.
All works fine, but some of the Vars are depending on Param Funcion of the strategy , so when i change them on the Parameters window, the plots of signal AFL's doesn't update on real time and i have to reload every AFL for taking the proper values.
So, is there any way of plotting signals on another panel and reflecting the changes on real time?


Not sure I understand your problem, maybe if you show an example would be easier to understand, because if you change the value of a static variable, it should update all charts where you read it.
Are you using realtime data ?
If not consider using

1 Like

Hi Awilson, i used RequestTimedRefresh( 0.1 ) and now is working on real Time.
Curiously if I lower even more the TimedRefresh, the refresh time lengthens instead of shortening. Maybe it's also constrained to the calculation time employed by the formula,now on 53ms, but now it's ok. The Lag is minimal.
Thanks !