problem with iCustom, thanks for who answers me!
Post all relevant code.
How To Ask Questions The Smart Way. (2004)
Be precise and informative about your problem
- Can't verify iCustom calls since you didn't post any of the indicator's inputs.
- Can't verify iCustom calls since you didn't post whether the calls are inside OnTick or not.
Post all relevant code.
How To Ask Questions The Smart Way. (2004)
Be precise and informative about your problem
- Can't verify iCustom calls since you didn't post any of the indicator's inputs.
- Can't verify iCustom calls since you didn't post whether the calls are inside OnTick or not.
Hi thanks for replying, I solved the problem that it did not enter short, but another one has arisen.
Now I'm sending you the code directly, anyway
Indicator: #property copyright "" #property link "" #property indicator_buffers 5 #property indicator_color1 Yellow #property indicator_color2 Red #property indicator_color3 Blue // The color for displaying arrows #property indicator_color4 Green // Long signal #property indicator_color5 Red // Short signal #property indicator_width1 1 #property indicator_width2 3 #property indicator_width3 3 // Width of the arrows #property indicator_width4 2 // Long signal arrow #property indicator_width5 2 // Short signal arrow extern int Lb = 3; extern int Arrow_Distance = 5; double ssla[],sslb[],sslc[],Up_Arrow_Buffer[],Down_Arrow_Buffer[],Hld,Hlv,Hlvprev; #property indicator_chart_window //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators IndicatorBuffers(5); SetIndexBuffer(0,sslc); SetIndexStyle(0,DRAW_LINE,STYLE_SOLID); SetIndexBuffer(1,ssla); SetIndexStyle(1,DRAW_LINE,STYLE_SOLID); SetIndexBuffer(2,sslb); SetIndexStyle(2,DRAW_LINE,STYLE_SOLID); SetIndexStyle(3, DRAW_ARROW); SetIndexBuffer(3, Up_Arrow_Buffer); SetIndexArrow(3, 233); // Up arrow SetIndexStyle(4, DRAW_ARROW); SetIndexBuffer(4, Down_Arrow_Buffer); SetIndexArrow(4, 234); // Down arrow //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { //---- for(int i=Bars-Lb;i>=0;i--) { if(Close[i]>iMA(Symbol(),0,Lb,0,MODE_SMA,PRICE_HIGH,i+1)) Hld = 1; else { if(Close[i]<iMA(Symbol(),0,Lb,0,MODE_SMA,PRICE_LOW,i+1)) Hld = -1; else Hld = 0; } if(Hld!=0) Hlv = Hld; if(Hlv == -1){ sslc[i] = iMA(Symbol(),0,Lb,0,MODE_SMA,PRICE_HIGH,i+1); ssla[i] = iMA(Symbol(),0,Lb,0,MODE_SMA,PRICE_HIGH,i+1); }else{ sslc[i] = iMA(Symbol(),0,Lb,0,MODE_SMA,PRICE_LOW,i+1); sslb[i] = iMA(Symbol(),0,Lb,0,MODE_SMA,PRICE_LOW,i+1); } } for(i=Bars-Lb;i>=0;i--) { if(sslb[i] == iMA(Symbol(),0,Lb,0,MODE_SMA,PRICE_LOW,i+1) && sslb[i+1] != iMA(Symbol(),0,Lb,0,MODE_SMA,PRICE_LOW,i+2)) { Up_Arrow_Buffer[i] = sslb[i] - (Arrow_Distance * Point); continue; } if(ssla[i] == iMA(Symbol(),0,Lb,0,MODE_SMA,PRICE_HIGH,i+1) && ssla[i+1] != iMA(Symbol(),0,Lb,0,MODE_SMA,PRICE_HIGH,i+2)) { Down_Arrow_Buffer[i] = ssla[i] + (Arrow_Distance * Point); continue; } Up_Arrow_Buffer[i] = EMPTY_VALUE; Down_Arrow_Buffer[i] = EMPTY_VALUE; } //---- return(0); } //+------------------------------------------------------------------+
EA: extern double lb = 3; double Get_TFT_Yellow_Value(int index) { return (iCustom(NULL, 0, "TFT_Arrows", lb, 3, 0, index)); } double Get_TFT_Red_Value(int index) { return (iCustom(NULL, 0, "TFT_Arrows", lb, 3, 1, index)); } double Get_TFT_Blue_Value(int index) { return (iCustom(NULL, 0, "TFT_Arrows", lb, 3, 2, index)); } double Get_TFT_UpArrow_Value(int index) { return (iCustom(NULL, 0, "TFT_Arrows", lb, 3, 3, index)); } double Get_TFT_DownArrow_Value(int index) { return (iCustom(NULL, 0, "TFT_Arrows", lb, 3, 4, index)); } bool TFT_SaysBuy() { if (Get_TFT_UpArrow_Value(0) != EMPTY_VALUE && Get_TFT_Blue_Value(0) ) { return (true); } else if(Get_TFT_Yellow_Value(0)){ return (false); } return (false); } bool TFT_SaysSell() { if (Get_TFT_DownArrow_Value(0) != EMPTY_VALUE && Get_TFT_Red_Value(0)) { return (true); } else if(Get_TFT_Yellow_Value(0)){ return (false); } return (false); } void OnTick () { if ( TFT_SaysBuy()) { //code... } if (TFT_SaysSell()) { //code... } }
I do not see a condition given to this entry ..
if (Get_TFT_UpArrow_Value(0) != EMPTY_VALUE && Get_TFT_Blue_Value(0) ) { return (true); } else if(Get_TFT_Yellow_Value(0)){True is non-zero. EMPTY_VALUE is also non-zero. These are not valid tests.
You're right, thanks.
Resolved.


hello, I was implementing an indicator in my EA, but I don't understand why it takes only the buffer of the long and not of the short, I send you below the codes to understand what I have done.
Thanks for whoever answers me