I've been working on this over the weekend, and I don't think it's possible to create an object at the CCI horizontal level line, because ObjectCreate requires me to enter a price, which I don't know since the level is dynamic. I'm thinking that I should rather use ObjectGetDouble, but this does not work either, supposedly because I'm not creating an object. I have seen a few indy's that display the price at the different Fibonacci levels, but I also cannot get that to work. So, I'm at the point where it seems impossible to set this alert.
double _price=ObjectGetDouble(0,indicator_level1,OBJPROP_LEVELVALUE); Print("price ",_price); //Prints 0.0 (incorrect) Print("level ",indicator_level1); //Prints 100 (correct) Print("OBJPROP ",OBJPROP_LEVELVALUE); //Prints 204 (incorrect)
Your question makes no sense. CCI is in a separate window. Price doesn't exist in the separate window.
Wait for CCI to read above 100, When it does, the current price is the price you want.
Your question makes no sense. CCI is in a separate window. Price doesn't exist in the separate window.
Wait for CCI to read above 100, When it does, the current price is the price you want.
Thank you for your reply. I probably should have mentioned this, but I have a workaround to get the CCI indi on the main chart window as per the screenshot (link at bottom of this tread). The CCI value is not equal to the price. So this is why I was wondering if the price of the 100 and the -100 level can be captured. I would like to have some code e.g. if Ask>price at level 100, create sell alert. I have a Fibo indy which capture the price at the various fibo levels, but I am unable to modify this for the CCI levels. Here is the fibo code
int fibHigh = iHighest(Symbol(),Period(),MODE_HIGH,WindowFirstVisibleBar()-1,1); int fibLow = iLowest(Symbol(),Period(),MODE_LOW,WindowFirstVisibleBar()-1,1); datetime highTime = Time[fibHigh]; datetime lowTime = Time[fibLow]; if(fibHigh>fibLow){ WindowRedraw(); ObjectCreate("XIT_FIBO",OBJ_FIBO,0,highTime,High[fibHigh],lowTime,Low[fibLow]); color levelColor = Red; } else{ WindowRedraw(); ObjectCreate("XIT_FIBO",OBJ_FIBO,0,lowTime,Low[fibLow],highTime,High[fibHigh]); levelColor = Gold; } double fiboPrice1=ObjectGet("XIT_FIBO",OBJPROP_PRICE1); double fiboPrice2=ObjectGet("XIT_FIBO",OBJPROP_PRICE2); double fiboPriceDiff = fiboPrice2-fiboPrice1; string fiboValue0 = DoubleToStr(fiboPrice2-fiboPriceDiff*0.0,Digits); string fiboValue23 = DoubleToStr(fiboPrice2-fiboPriceDiff*0.236,Digits); string fiboValue38 = DoubleToStr(fiboPrice2-fiboPriceDiff*0.382,Digits); string fiboValue50 = DoubleToStr(fiboPrice2-fiboPriceDiff*0.50,Digits); string fiboValue61 = DoubleToStr(fiboPrice2-fiboPriceDiff*0.618,Digits); string fiboValue100 = DoubleToStr(fiboPrice2-fiboPriceDiff*1.0,Digits); ObjectSet("XIT_FIBO",OBJPROP_FIBOLEVELS,6); ObjectSet("XIT_FIBO",OBJPROP_FIRSTLEVEL+0,0.0); ObjectSet("XIT_FIBO",OBJPROP_FIRSTLEVEL+1,0.236); ObjectSet("XIT_FIBO",OBJPROP_FIRSTLEVEL+2,0.382); ObjectSet("XIT_FIBO",OBJPROP_FIRSTLEVEL+3,0.50); ObjectSet("XIT_FIBO",OBJPROP_FIRSTLEVEL+4,0.618); ObjectSet("XIT_FIBO",OBJPROP_FIRSTLEVEL+5,1.0); ObjectSet("XIT_FIBO",OBJPROP_LEVELCOLOR,levelColor); ObjectSet("XIT_FIBO",OBJPROP_LEVELWIDTH,1); ObjectSet("XIT_FIBO",OBJPROP_LEVELSTYLE,STYLE_DASHDOTDOT); ObjectSetFiboDescription( "XIT_FIBO", 0,fiboValue0+" --> 0.0%"); ObjectSetFiboDescription( "XIT_FIBO", 1,fiboValue23+" --> 23.6%"); ObjectSetFiboDescription( "XIT_FIBO", 2,fiboValue38+" --> 38.2%"); ObjectSetFiboDescription( "XIT_FIBO", 3,fiboValue50+" --> 50.0%"); ObjectSetFiboDescription( "XIT_FIBO", 4,fiboValue61+" --> 61.8%"); ObjectSetFiboDescription( "XIT_FIBO", 5,fiboValue100+" --> 100.0%");
https://www.mql5.com/en/charts/5264417/eurusd-m1-ironfx-financial-services

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi Everyone
I've been struggling to modify an indicator so that it alerts me when the price crosses the upper or lower CCI level (rather than when the CCI indicator line crosses a level). In other words when Ask>Upper_indicator_level (100) -----> Alert Sell
But it does not get the price at that level. My understanding is that the best way (and perhaps the only way) that this can be done is to create an object at that line and then get the price of the object. So if I print the indicator_level1 it is 100. Objectcreate is looking for a price hee and I am saying the price is 100. This is obviouly not correct. So I do not know how to enter the price for a certain level, because if I know what the price is at that level, I would not need ObjectGet(). With the code I have, it does not draw an object and when I print the value of ObjectGet, it actually prints the value of the indicator, namely 100. Can someone please help me with this? Thank you