This function works for only the measurement in the first assignment. Is it possible to have the trend angle function recalculate every tick
MqlRates Priceinfo[];
MqlTick ticks[];
----------------------------------------+
void OnTick()
{CopyTicks(_Symbol,ticks,COPY_TICKS_ALL,0,30);
ArraySetAsSeries(ticks,true);
uint start=GetTickCount();
double price [];
ArraySetAsSeries(Priceinfo,true);
int date=CopyRates(_Symbol,PERIOD_CURRENT,0,20,Priceinfo);
ArraySetAsSeries(price,true);
int bb=iBands(_Symbol,PERIOD_CURRENT,20,0,2,PRICE_CLOSE);
CopyBuffer(bb,1,0,10,price);
double a=ObjectCreate(_Symbol,"xxfile",OBJ_TRENDBYANGLE,0,Priceinfo[1].time,
price [1],Priceinfo[0].time,price [0]);
double TrendCurrent=ObjectGetValueByTime(_Symbol,"xxfile",Priceinfo[0].time);
double Angle=ObjectGetDouble(_Symbol,"xxfile",OBJPROP_ANGLE,0);
double degree=Angle;
double value=NormalizeDouble(TrendCurrent,3);
{Alert(degree);}
}
//+------------------------------------------------------------------+
- ticks counter
- Indicators: Heikin Ashi Lines
- using 2 differents simplemoving average
ingilizce soruya cevap almak için forumun dilini ingilizceye çevirerek sormanız gerekir ayrıca kod eklerken düzenleyip buraya yapıştırın okunurluğu kolay olsun aşağıdaki gibi
void OnTick() { CopyTicks(_Symbol,ticks,COPY_TICKS_ALL,0,30); ArraySetAsSeries(ticks,true); uint start=GetTickCount(); double price []; ArraySetAsSeries(Priceinfo,true); int date=CopyRates(_Symbol,PERIOD_CURRENT,0,20,Priceinfo); ArraySetAsSeries(price,true); int bb=iBands(_Symbol,PERIOD_CURRENT,20,0,2,PRICE_CLOSE); CopyBuffer(bb,1,0,10,price); double a=ObjectCreate(_Symbol,"xxfile",OBJ_TRENDBYANGLE,0,Priceinfo[1].time, price [1],Priceinfo[0].time,price [0]); double TrendCurrent=ObjectGetValueByTime(_Symbol,"xxfile",Priceinfo[0].time); double Angle=ObjectGetDouble(_Symbol,"xxfile",OBJPROP_ANGLE,0); double degree=Angle; double value=NormalizeDouble(TrendCurrent,3); {Alert(degree);} }
My question is: How can I make the above-mentioned object codes dynamic for the ontick function? So how to add onCalculate?
#property copyright "Copyright 2022, MetaQuotes Ltd."
#property link "https://www.mql5.com"
#property version "1.00"
input string InpName="object";
MqlRates Priceinfo[];
void OnTick()
{
double price [];
ArraySetAsSeries(Priceinfo,true);
int date=CopyRates(_Symbol,PERIOD_CURRENT,0,20,Priceinfo);
ArraySetAsSeries(price,true);
int bb=iBands(_Symbol,PERIOD_CURRENT,20,0,2,PRICE_CLOSE);
CopyBuffer(bb,1,0,10,price);
ObjectCreate(_Symbol,"object",OBJ_TRENDBYANGLE,0,Priceinfo[1].time,
price [1],Priceinfo[0].time,price [0]);
double TrendCurrent=ObjectGetValueByTime(_Symbol,"object",Priceinfo[0].time);
double Angle=ObjectGetDouble(_Symbol,"object",OBJPROP_ANGLE,0);
double degree= Angle;
double value=NormalizeDouble(TrendCurrent,3);
Print("degree",degree);
}
I wanted to see the angle of the BB upperband. But I can't have the object recalculated on every new bar. How do I add a loop? Excuse me I'm a beginner
Alım-satım fırsatlarını kaçırıyorsunuz:
- Ücretsiz alım-satım uygulamaları
- İşlem kopyalama için 8.000'den fazla sinyal
- Finansal piyasaları keşfetmek için ekonomik haberler
Kayıt
Giriş yap
Gizlilik ve Veri Koruma Politikasını ve MQL5.com Kullanım Şartlarını kabul edersiniz
Hesabınız yoksa, lütfen kaydolun