Skip to content

Instantly share code, notes, and snippets.

@sin32775
Created December 21, 2020 07:57
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/602401b5ca32eb988a5d2af3fea31cd0 to your computer and use it in GitHub Desktop.
Save sin32775/602401b5ca32eb988a5d2af3fea31cd0 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(hMA)<rates_total)
return(0);
int to_copy;
to_copy=rates_total-prev_calculated;
if(to_copy==0)
to_copy++;
if(CopyBuffer(hMA,0,0,to_copy,MABuffer)<=0)
return(0);
// Print(rates_total,",",prev_calculated);
//--- 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