How to get prices of these fibo levels?
I tried this but nothing. No prices in Data window.
ObjectGetDouble(0,_name,OBJPROP_PRICE,k,_fiboLevels[k]);
+ also tried to get prices by using fibo level calculation formula but then I get levels which are not the same as using OBJ_FIBO.
Formula = NormalizeDouble( _weeklyRates[i-1].high - (_range * _fiboLevels[k]/100.0),Digits());
Inserted Code
double _fiboLevels[21]= {0,0.236,0.382,0.5,0.618,1,1.61,2.61,3.61,4.23,4.61,-0.236,-0.382,-0.5,-0.618,-1,-1.61,-2.61,-3.61,-4.23,-4.61}; if(Bars(_Symbol,_Period)<rates_total) return(-1); MqlRates _weeklyRates[]; int _weeklyRatesCopied=CopyRates(_Symbol,PERIOD_W1,0,inpPeriodsToDisplay+1,_weeklyRates); for(int i=1; i<_weeklyRatesCopied && !_StopFlag; i++) { string _name = inpUniqueID+":"+(string)i; double _range = _weeklyRates[i-1].high-_weeklyRates[i-1].low; ObjectCreate(0,_name,OBJ_FIBO,0,_weeklyRates[i].time,_weeklyRates[i].open+_range,_weeklyRates[i].time+PeriodSeconds(PERIOD_W1),_weeklyRates[i].open); ObjectSetInteger(0,_name,OBJPROP_RAY,false); ObjectSetInteger(0,_name,OBJPROP_LEVELS,21); ObjectSetInteger(0,_name,OBJPROP_COLOR,clrNONE); for(int k=0; k<21; k++) { ObjectSetInteger(0,_name,OBJPROP_LEVELCOLOR,k,k==0?inpLevels0Color:_fiboLevels[k]>0?inpLevelsuColor:inpLevelsdColor); ObjectSetInteger(0,_name,OBJPROP_LEVELSTYLE,k,k==0?inpLevel0Style:inpLevelsStyle); ObjectSetDouble(0,_name,OBJPROP_LEVELVALUE,k,_fiboLevels[k]); ObjectSetString(0,_name,OBJPROP_LEVELTEXT,k,DoubleToString(_fiboLevels[k]*100,1)+" %"); } }
ObjectGetDouble(0,_name,OBJPROP_PRICE,k,_fiboLevels[k]);
+ also tried to get prices by using fibo level calculation formula but then I get levels which are not the same as using OBJ_FIBO.
Formula = NormalizeDouble( _weeklyRates[i-1].high - (_range * _fiboLevels[k]/100.0),Digits());