mohamed alfekey:
You cannot define a text buffer, there is no such thing. - Only double is allowed.
please help i have this errors
+++++++++++
Dominik Egert #:
You cannot define a text buffer, there is no such thing. - Only double is allowed.
thanks i fixed this But have new problem ....You cannot define a text buffer, there is no such thing. - Only double is allowed.
The overwriting on the indicator disappears after it appears on two or three candles in the strategy tester
#property indicator_chart_window #property indicator_buffers 2 #property indicator_color2 Lime //---- input parameters int ExtDepth=12; //---- buffers double ExtMapBuffer[]; double ExtArrowBuffer[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,ExtMapBuffer); SetIndexEmptyValue(0,0.0); SetIndexStyle(1,DRAW_ARROW); SetIndexArrow(1,218); SetIndexBuffer(1,ExtArrowBuffer); SetIndexEmptyValue(1,0.0); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int counted_bars=IndicatorCounted(); //---- check for possible errors if(counted_bars<0) return(-1); //---- last counted bar will be recounted if(counted_bars>0) counted_bars--; int limit=Bars-counted_bars; //---- main loop for(int i=0; i<limit; i++) { //---- calculate the indicator value double open = Open[i]; double close = Close[i]; double high = High[i]; double low = Low[i]; double body = MathAbs(open - close); double upper_tail = high - MathMax(open, close); double lower_tail = MathMin(open, close) - low; double mid_body = body / 2; if (open == close) { //---- do not return any value ExtMapBuffer[i] = 0.0; ExtArrowBuffer[i] = 0.0; } else if (open < close && (lower_tail <= mid_body && upper_tail > body && low < open)) { //---- draw an arrow above the candle and write Strong ExtMapBuffer[i] = high + 10 * Point; ExtArrowBuffer[i] = high + 4 * Point; ObjectCreate("N"+i,OBJ_TEXT,0,Time[i],high+10*Point); ObjectSetText("N"+i,"N",10,"Arial",Lime); } else if (open < close && (lower_tail > mid_body && upper_tail >= body)) { //---- draw an arrow above the candle and write Strong ExtMapBuffer[i] = high + 10 * Point; ExtArrowBuffer[i] = high + 4 * Point; ObjectCreate("N"+i,OBJ_TEXT,0,Time[i],high+10*Point); ObjectSetText("N"+i,"N",10,"Arial",Lime); } else { //---- do nothing ExtMapBuffer[i] = 0.0; ExtArrowBuffer[i] = 0.0; } } //---- done return(0); } //+------------------------------------------------------------------+
Files:
Screenshot_1.jpg
62 kb
//---- main loop for(int i=0; i<= limit; i++)
Will that change work ?
mohamed alfekey #:
thanks i fixed this But have new problem ....
thanks i fixed this But have new problem ....
The overwriting on the indicator disappears after it appears on two or three candles in the strategy tester
Because you are interating backwards, and you are reusing the same object names.
Create the object names using the timestamp from Time[] array.
Change your for loop to work chronologically forward.
Add #property strict to the top of the file.
Use the "modern" names for event handlers.
Dominik Egert #:
I apologize to you, but I do not have enough experience to understand all of this. Therefore, if you correct one of them for me, I will understand more. Thank you very much.
Because you are interating backwards, and you are reusing the same object names.
Create the object names using the timestamp from Time[] array.
Change your for loop to work chronologically forward.
Add #property strict to the top of the file.
Use the "modern" names for event handlers.
instead of OnStart, use OnCalculate
mohamed alfekey #:
I apologize to you, but I do not have enough experience to understand all of this. Therefore, if you correct one of them for me, I will understand more. Thank you very much.
I apologize to you, but I do not have enough experience to understand all of this. Therefore, if you correct one of them for me, I will understand more. Thank you very much.
take a look at working versions on code base. There are good coded versions available. Learn from them.
It will be better than getting spoon fed by me.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
please help i have this errors
+++++++++++