- Buffers are auto-sizing arrays. They usually result in lines or dots on the chart but not necessarily.
- You can read an indicator's buffers via iCustom.
- Create some non-displaying buffers, put your values in there. Since # of open orders is only valid currently, store that value in index zero.
Hello,
I am just getting started building indicators, and I am confused with indicator buffers. I understand that these are the values that are sent to the terminal and can be used by other indicators/expert advisors, but the documentation is confusing me. I am trying to create a very simple indicator that shows the total number of buys, sells, and open pips profit on a selected currency pair. I have all of the values computing correctly and alerting to me, but how can I make these values buffers? For example: I have numberOfBuysOpen, numberOfSellsOpen, and pipsProfit as variables that I'd like to be buffers.
Thanks for the help
First I will defer to whroeder1 he/she has the experience and the chops.
You could create arrays like
double numberOfBuysOpen[], numberOfSellsOpen[], pipsProfit[];
Then later in your code just input the calculations for that value on the appropriate bar like
//+------------------------------------------------------------------+{ //--- int limit=rates_total; if(prev_calculated==0)limit=rates_total-1; for(int i=limit-prev_calculated;i>0;i--) { numberOfBuysOpen[i-1]=YourNumberOfBuyOpenFunction(); numberOfSellsOpen[i-1]=YourNumberOfSellsOpenFunction(); pipsProfit[i-1]=YourPipsProfitFunction(); } //--- return value of prev_calculated for next call return(rates_total); }
Now you will have your values in the indicator buffer.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello,
I am just getting started building indicators, and I am confused with indicator buffers. I understand that these are the values that are sent to the terminal and can be used by other indicators/expert advisors, but the documentation is confusing me. I am trying to create a very simple indicator that shows the total number of buys, sells, and open pips profit on a selected currency pair. I have all of the values computing correctly and alerting to me, but how can I make these values buffers? For example: I have numberOfBuysOpen, numberOfSellsOpen, and pipsProfit as variables that I'd like to be buffers.
Thanks for the help