Create a custom indicator
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[] ) { int i, limit; if (prev_calculated < 0) return (- 1 ); if (prev_calculated == 0) limit = rates_total - InpDensPeriod; else limit = rates_total - prev_calculated + 1; for (i = limit; i >= 0 ; i--) ExtDensBuffer[i] = density(Symbol(), PERIOD_CURRENT, InpDensPeriod, i); return (rates_total); } //+------------------------------------------------------------------+ double density( string currency, int timeframe, int period, int shift){ . . . .
Since you already have a function, you can just call it like this.
for (i = limit; i >= 0 ; i--) ExtDensBuffer[i] = density(Symbol(), PERIOD_CURRENT, InpDensPeriod, i);Don't mix apples and oranges.
What is the problem?
the problem is that I want to see the graph.
Naguisa Unada:
i will try and i will tell you. THANKS A LOT
Naguisa, it works thank you so much, and I like it.
The result should be in percentage....but i'll fix it no problem! :)
Hi, I'm trying for the first time to write an indicator,
I have a function that works, like a sort of "density" calculation, but converting it in similar indicator still not working...maybe i still miss some passages,
function
indicator