Switching from MQL4

Posted By: Fred7

Switching from MQL4 - 09/10/19 19:33

Hi guys, I come from an MQL4 background and just trying to figure out or get my head around this coding. To learn I'm trying to stay on indi's that I understand and once I get the flow will move to the better stuff. (Yes, I did do all the lectures, and trying to sift through the HELP)

How will I do the following?

I thought it'll be something like this.

function RSi_1hour()
	TimeFrame = 4;
	vars Close = series(priceClose());
	vars rsi60 = series(RSI(Close,12));
	return rsi60;

function run()
  BarPeriod = 15;
  MaxBars = 500;
  LookBack = 250;
  asset("EUR/USD"); // dummy asset
  PlotWidth = 800;
  PlotHeight1 = 400;
  vars Price = series(price());
  vars Close = series(priceClose());
  vars RSI12 = series(RSI(Close,12));
  vars rsiHTF = series(RSi_1hour());


Q1. I'd like to display both TF's for RSI on a M15 chart.
Q2. If I comment out the two "rsiHTF"'s run this the M15 RSI shows normal, but uncomment those two lines and it is staggered and the H1 RSI is only straight line.

Help appreciated.
Posted By: jcl

Re: Switching from MQL4 - 09/11/19 11:32

Your function returned a pointer instead of a variable.

var RSi_1hour()
TimeFrame = 4;
vars Close = series(priceClose());
return RSI(Close,12);
Posted By: Fred7

Re: Switching from MQL4 - 09/11/19 15:19

© 2020 lite-C Forums