Roman Sharanov: Comment se fait-il que les cotations soient à 5 chiffres, mais que l'indicateur donne des valeurs à 4 chiffres ? Il n'y a pas d'arrondi ou autre
Je passe un mauvais moment. Je ne peux pas définir dans la logique de l'indicateur Bolingeer Bunds la règle de tracer des lignes à partir de la clôture du jour précédent.
La fonction iClose("USDCHF",PERIOD_D1,0) semble convenir, mais pas tout à fait. Lorsque l'on recalcule le cycle sur le graphique horaire, tout se casse immédiatement.
//+------------------------------------------------------------------+//| Клюква.mq4 |//| Алексей Корольков . |//| https://www.mql5.com/ru/users/alekkar |//+------------------------------------------------------------------+#property copyright"2020 Алексей Корольков ."#property link"https://www.mql5.com/ru/users/alekkar"#property description"Клюква"#property strict#include <MovingAverages.mqh>
#property indicator_chart_window#property indicator_buffers3#property indicator_color1 LightSeaGreen
#property indicator_color2 LightSeaGreen
#property indicator_color3 LightSeaGreen
//--- indicator parametersinputint InpBandsPeriod=20; // Bands Periodinputint InpBandsShift=0; // Bands Shiftinputdouble InpBandsDeviations=2.0; // Bands Deviationsinputstring SimbolUSD="USDIDX..";
//--- buffersdouble ExtMovingBuffer[];
double ExtUpperBuffer[];
double ExtLowerBuffer[];
double ExtStdDevBuffer[];
double Drv,DrvIn,min,max,minIn,maxIn,xx,xIn,natr,natrIn,ma1,ma2,bid1,bid2,R1,R2,R01,R02;
int tm,mn;
//+------------------------------------------------------------------+//| Custom indicator initialization function |//+------------------------------------------------------------------+intOnInit(void)
{
//--- 1 additional buffer used for counting.
IndicatorBuffers(4);
IndicatorDigits(Digits);
//--- middle line
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,ExtMovingBuffer);
SetIndexShift(0,InpBandsShift);
SetIndexLabel(0,"Bands SMA");
//--- upper band
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(1,ExtUpperBuffer);
SetIndexShift(1,InpBandsShift);
SetIndexLabel(1,"Bands Upper");
//--- lower band
SetIndexStyle(2,DRAW_LINE);
SetIndexBuffer(2,ExtLowerBuffer);
SetIndexShift(2,InpBandsShift);
SetIndexLabel(2,"Bands Lower");
//--- work bufferSetIndexBuffer(3,ExtStdDevBuffer);
//--- check for input parameterif(InpBandsPeriod<=0)
{
Print("Wrong input parameter Bands Period=",InpBandsPeriod);
return(INIT_FAILED);
}
//---
SetIndexDrawBegin(0,InpBandsPeriod+InpBandsShift);
SetIndexDrawBegin(1,InpBandsPeriod+InpBandsShift);
SetIndexDrawBegin(2,InpBandsPeriod+InpBandsShift);
//--- initialization donereturn(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+//| Bollinger Bands |//+------------------------------------------------------------------+intOnCalculate(constint rates_total,
constint prev_calculated,
constdatetime &time[],
constdouble &open[],
constdouble &high[],
constdouble &low[],
constdouble &close[],
constlong &tick_volume[],
constlong &volume[],
constint &spread[])
{
int i,pos;
//---if(rates_total<=InpBandsPeriod || InpBandsPeriod<=0)
return(0);
//--- counting from 0 to rates_totalArraySetAsSeries(ExtMovingBuffer,false);
ArraySetAsSeries(ExtUpperBuffer,false);
ArraySetAsSeries(ExtLowerBuffer,false);
ArraySetAsSeries(ExtStdDevBuffer,false);
ArraySetAsSeries(close,false);
//--- initial zeroif(prev_calculated<1)
{
for(i=0; i<InpBandsPeriod; i++)
{
ExtMovingBuffer[i]=EMPTY_VALUE;
ExtUpperBuffer[i]=EMPTY_VALUE;
ExtLowerBuffer[i]=EMPTY_VALUE;
}
}
//--- определение АТР for(i=InpBandsPeriod-1; i>=0; i--)
{
xx=High[i]-Low[i];
Drv+=xx;
if(min>xx) min=xx;
if(max<xx) max=xx;
xIn=iHigh(SimbolUSD,NULL,i)-iLow(SimbolUSD,NULL,i);
DrvIn+=xIn;
if(minIn>xIn) minIn=xIn;
if(maxIn<xIn) maxIn=xIn;
}
Drv/=InpBandsPeriod;
DrvIn/=InpBandsPeriod;
natr=((Drv-min)/(max-min))*100; //тут определяем пройденное значение атр инструментом на графике
natrIn=((DrvIn-minIn)/(maxIn-minIn))*100; //тут определяем пройденное значение атр инструментом на индексе доллара//средние АТР
ma1=iMA(NULL,0,InpBandsPeriod,0,2,1,0);
ma2=iMA(SimbolUSD,0,InpBandsPeriod,0,2,1,0);
//определяем знак АТР
bid1=MarketInfo(NULL,MODE_BID);
bid2=MarketInfo(SimbolUSD,MODE_BID);
if (bid1-ma1<0) Drv=Drv*(-1); // если цена падает значит минусif (bid2-ma2<0) DrvIn=DrvIn*(-1); // если цена падает значит минус// а теперь сама она родная //где Drv инструмент графика,а DrvIn индекс доллара//расчёт индекса волатильности для инструмента
R01 = (1-(1+Drv)/(1+max))*100;//используем для движения вверх
R02 = (1-(1-Drv)/(1+max))*100;//используем для движения вниз//расчёт индекса волатильности для доллара
R1 = (1-(1+DrvIn)/(1+maxIn))*100;//
R2 = (1-(1-DrvIn)/(1+maxIn))*100;//используем для движения вниз // далее сам расчёт//--- начальный расчетif(prev_calculated>1)
pos=prev_calculated-1;
else
pos=0;
//--- главный циклfor(i=pos; i<rates_total && !IsStopped(); i++)
{
//--- средняя линия
ExtMovingBuffer[i]=SimpleMA(i,InpBandsPeriod,close);
//--- рассчитайте и запишите со стандартным отклонением
ExtStdDevBuffer[i]=StdDev_Func(i,close,ExtMovingBuffer,InpBandsPeriod); // тут наверно смогу разместить код //--- верхняя линия указывает зону перекупленности// -- тут хотел параметр ExtMovingBuffer[i] заменить на iClose("USDCHF",PERIOD_D1,0)
ExtUpperBuffer[i]=ExtMovingBuffer[i]+(max)*(R01+R2)/2; //Print("Drv ",Drv,",DrvIn",DrvIn,", R1", R1,", R2 ", R2);//--- нижняя линия указывает зону перепроданности
ExtLowerBuffer[i]=ExtMovingBuffer[i]+(-max)*(R02+R1)/2;
//---
}
//---- OnCalculate done. Return new prev_calculated.return(rates_total);
}
//+------------------------------------------------------------------+//| Calculate Standard Deviation |//+------------------------------------------------------------------+double StdDev_Func(int position,constdouble &price[],constdouble &MAprice[],int period)
{
//--- variablesdouble StdDev_dTmp=0.0;
//--- check for positionif(position>=period)
{
//--- calcualte StdDevfor(int i=0; i<period; i++)
StdDev_dTmp+=MathPow(price[position-i]-MAprice[position],2);
StdDev_dTmp=MathSqrt(StdDev_dTmp/period);
}
//--- return calculated valuereturn(StdDev_dTmp);
}
//+------------------------------------------------------------------+
Опубликовал MetaTrader 4 сигнал Выставил продукт Советник DSvoltage использует индикатор MACD. Торговый объём зависит от результата предыдущих сделок, фиксированного лота, и размера показателя Автолота. Советник DCvoltage хеджирует размер позиции и направление в зависимости от ситуации на рынке за счёт перекрытых ордеров. В советнике...
Vous pouvez déplacer le pointeur dans les fichiers binaires et lire et écrire à partir de n'importe quel endroit. Existe-t-il un moyen de supprimer, effacer, du point actuel à la fin du fichier ? Est-il possible d'écrire un signe de la fin du fichier ? Peut-on la réduire ? Sans écrasement.
Une question se pose à propos des fichiers binaires : est-il possible, d'une manière ou d'une autre, de leur couper la queue ?
vous ne pouvez pas
Cherchez un sujet dans la section 4. Il y a eu une telle question il y a environ une semaine et quelqu'un a suggéré une solution avec l'appel WinAPI (.dll)
Si vous n'avez pas de compte, veuillez vous inscrire
Autorisez l'utilisation de cookies pour vous connecter au site Web MQL5.com.
Veuillez activer les paramètres nécessaires dans votre navigateur, sinon vous ne pourrez pas vous connecter.
Vous êtes connecté. L'authentification à deux facteurs a été désactivée. Configurez-la à nouveau et scannez un nouveau code QR, ou continuez avec l'authentification à deux facteurs désactivée.
Comment se fait-il que les cotations soient à 5 chiffres, mais que l'indicateur donne des valeurs à 4 chiffres ? Il n'y a pas d'arrondi ou autre
Merci.
Pourquoi la fonction ...
PositionsTotal()... ...renvoie parfois 0 alors qu'il y a en fait une position ouverte? MQL5
La logique de son fonctionnement en dépend
... voici la preuve
Merci pour votre aide
Bon après-midi.
Une question se pose à propos des fichiers binaires : existe-t-il un moyen de leur couper la queue ?
Bon après-midi.
Voici une question sur les fichiers binaires : existe-t-il un moyen de leur couper la queue ?
nom de fichier = "эта@с_хвостом.bin" ;
nom de fichier = "a_et@tailless" ;
)))
Ou quelle queue voulez-vous dire ?
nom de fichier = "эта@с_хвостом.bin" ;
nom de fichier = "a_ta@no_tail" ;
)))
Ou à quelle queue faisiez-vous référence ?
Vous pouvez déplacer le pointeur dans les fichiers binaires et lire et écrire à partir de n'importe quel endroit. Existe-t-il un moyen de supprimer, effacer, du point actuel à la fin du fichier ? Est-il possible d'écrire un signe de la fin du fichier ? Peut-on la réduire ? Sans écrasement.
Bon après-midi.
Une question se pose à propos des fichiers binaires : est-il possible, d'une manière ou d'une autre, de leur couper la queue ?
vous ne pouvez pas
Cherchez un sujet dans la section 4. Il y a eu une telle question il y a environ une semaine et quelqu'un a suggéré une solution avec l'appel WinAPI (.dll)