Skip to content

Instantly share code, notes, and snippets.

@sin32775
Created December 21, 2020 12:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sin32775/8c6e5d6ba31575d8d4ea65384d6cb0c9 to your computer and use it in GitHub Desktop.
Save sin32775/8c6e5d6ba31575d8d4ea65384d6cb0c9 to your computer and use it in GitHub Desktop.
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime &time[],
const double &open[],
const double &high[],
const double &low[],
const double &close[],
const long &tick_volume[],
const long &volume[],
const int &spread[])
{
//---
if(BarsCalculated(hRSI)<rates_total && BarsCalculated(hRSIMA)<rates_total)
return(0);
int to_copy;
to_copy=rates_total-prev_calculated;
if(to_copy==0)
to_copy++;
if(CopyBuffer(hRSI,0,0,to_copy,RSI_Buffer)<=0)
return(0);
if(CopyBuffer(hRSIMA,0,0,to_copy,MA_Buffer)<=0)
return (0);
//--- return value of prev_calculated for next call
return(rates_total);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment