I implemented it with OnTimer() and nothing came out of it. Unfortunately the onTimer() event doesn't calculate the indicator and the delay is saved, maybe a loud statement and I've done something wrong, please correct. Thanks!
What you have done is not an implementation through OnTimer(). You just get values there (all the history, and every second, moreover, without checking). Anyway, I don't think you may implement it by yourself. Wait for answer of branch author:)
Alexey Kozitsyn: What you have done is not an implementation through OnTimer(). You only get values there (all of history, and every second, without any checks). In general, it is unlikely that you will be able to implement it by yourself. Wait for answer of branch author:)
Yes, thanks! already contacted the author of the branch, where he promised to help! I am waiting for a reply))
I implemented it with OnTimer() and nothing came out of it. Unfortunately the onTimer() event doesn't calculate the indicator and the delay is saved, maybe a loud statement and I've done something wrong, please correct. Thanks!
#property indicator_separate_window #property indicator_buffers1 #property indicator_plots1 //---- plot MA #property indicator_label1 "MA" #property indicator_type1 DRAW_LINE #property indicator_color1 clrRed #property indicator_style1 STYLE_SOLID #property indicator_width1 1 //--- input parameters bool AsSeries=true; int period=15; inputENUM_TIMEFRAMES TimeFrame=PERIOD_CURRENT;//Период графика ENUM_MA_METHOD smootMode=MODE_EMA; ENUM_APPLIED_PRICE price=PRICE_CLOSE; int shift=0; //--- indicator buffers double MABuffer[]; int ma_handle; int to_copy; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ intOnInit() { //--- indicator buffers mapping SetIndexBuffer(0,MABuffer,INDICATOR_DATA); Print("Параметр AsSeries = ",AsSeries); Print("Индикаторный буфер после SetIndexBuffer() является таймсерией = ", ArrayGetAsSeries(MABuffer)); //--- set short indicator name IndicatorSetString(INDICATOR_SHORTNAME,"MA("+period+")"+AsSeries); //--- set AsSeries (depends on input parameter) ArraySetAsSeries(MABuffer,AsSeries); Print("Индикаторный буфер после ArraySetAsSeries(MABuffer,true); является таймсерией = ", ArrayGetAsSeries(MABuffer)); //--- ma_handle=iMA(Symbol(),TimeFrame,period,shift,smootMode,price); EventSetTimer(1); return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ intOnCalculate(constint rates_total, constint prev_calculated, constdatetime &time[], constdouble &open[], constdouble &high[], constdouble &low[], constdouble &close[], constlong &tick_volume[], constlong &volume[], constint &spread[]) { //--- check if all data calculated if(BarsCalculated(ma_handle)<rates_total) return(0); //--- we can copy not all data //int to_copy; if(prev_calculated>rates_total || prev_calculated<=0) to_copy=rates_total; else { to_copy=rates_total-prev_calculated; //--- last value is always copied to_copy++; } //--- try to copy
//--- return value of prev_calculated for next call return(rates_total); } //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ //| Timer function | //+------------------------------------------------------------------+ voidOnTimer() { //--- CopyBuffer(ma_handle,0,0,to_copy,MABuffer); Print("Таймер"); } //+------------------------------------------------------------------+
I think what I meant was tomove everything inOnCalculate toOnTimer
A solution was suggested here, but as I am a novice programmer this is quite difficult for me to implement, which is why I asked for help in this thread
Good afternoon. I'm on the Delta_RSI indicator, it keeps drawing (see screenshot) histo in both directions at the same time (look for error). And it is possible to colour the zero signal coloured differently for above/below zero. Will you be able to see(correct)? Thank you.
Igor371: Afternoon. I'm on the Delta_RSI indicator, I have it constantly drawing (see screenshot) histo both ways at the same time (look for error). And it is possible to colour the no signal colour for above/below zero. Will you be able to see(correct)? Thank you.
Not really doing anything. I have big periods of 1000/250 on M1 for example. At some point the bargain becomes both sides of zero at the same time. I do not know exactly at what moment, but I will have a closer look. I have no problems with it in the code, nothing to fix?
Good afternoon. I can't seem to catch when the indicator breaks. It's standing there and everything is OK, but then it breaks. I have not encountered brokers to do any manipulations, because I often have the same thing with arrows, (but I put it down to drawing indices, and here RSI) I will put an owl to watch out for with screenshots.
I implemented it with OnTimer() and nothing came out of it. Unfortunately the onTimer() event doesn't calculate the indicator and the delay is saved, maybe a loud statement and I've done something wrong, please correct. Thanks!
What you have done is not an implementation through OnTimer(). You only get values there (all of history, and every second, without any checks). In general, it is unlikely that you will be able to implement it by yourself. Wait for answer of branch author:)
I implemented it with OnTimer() and nothing came out of it. Unfortunately the onTimer() event doesn't calculate the indicator and the delay is saved, maybe a loud statement and I've done something wrong, please correct. Thanks!
//| TestCopyBuffer3.mq5 |
//| Copyright 2009, MetaQuotes Software Corp. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "2009, MetaQuotes Software Corp."
#property link "https://www.mql5.com"
#property version "1.00"
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_plots 1
//---- plot MA
#property indicator_label1 "MA"
#property indicator_type1 DRAW_LINE
#property indicator_color1 clrRed
#property indicator_style1 STYLE_SOLID
#property indicator_width1 1
//--- input parameters
bool AsSeries=true;
int period=15;
input ENUM_TIMEFRAMES TimeFrame=PERIOD_CURRENT; //Период графика
ENUM_MA_METHOD smootMode=MODE_EMA;
ENUM_APPLIED_PRICE price=PRICE_CLOSE;
int shift=0;
//--- indicator buffers
double MABuffer[];
int ma_handle;
int to_copy;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//--- indicator buffers mapping
SetIndexBuffer(0,MABuffer,INDICATOR_DATA);
Print("Параметр AsSeries = ",AsSeries);
Print("Индикаторный буфер после SetIndexBuffer() является таймсерией = ",
ArrayGetAsSeries(MABuffer));
//--- set short indicator name
IndicatorSetString(INDICATOR_SHORTNAME,"MA("+period+")"+AsSeries);
//--- set AsSeries (depends on input parameter)
ArraySetAsSeries(MABuffer,AsSeries);
Print("Индикаторный буфер после ArraySetAsSeries(MABuffer,true); является таймсерией = ",
ArrayGetAsSeries(MABuffer));
//---
ma_handle=iMA(Symbol(),TimeFrame,period,shift,smootMode,price);
EventSetTimer(1);
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime &time[],
const double &open[],
const double &high[],
const double &low[],
const double &close[],
const long &tick_volume[],
const long &volume[],
const int &spread[])
{
//--- check if all data calculated
if(BarsCalculated(ma_handle)<rates_total) return(0);
//--- we can copy not all data
//int to_copy;
if(prev_calculated>rates_total || prev_calculated<=0) to_copy=rates_total;
else
{
to_copy=rates_total-prev_calculated;
//--- last value is always copied
to_copy++;
}
//--- try to copy
//--- return value of prev_calculated for next call
return(rates_total);
}
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| Timer function |
//+------------------------------------------------------------------+
void OnTimer()
{
//---
CopyBuffer(ma_handle,0,0,to_copy,MABuffer);
Print("Таймер");
}
//+------------------------------------------------------------------+
I assume that means tomove everything inOnCalculate toOnTimer
In order to rewrite it, all indicators to be included must also be under mql5
Afternoon. I'm on the Delta_RSI indicator, I have it constantly drawing (see screenshot) histo both ways at the same time (look for error). And it is possible to colour the no signal colour for above/below zero. Will you be able to see(correct)? Thank you.
describe what you do to break it ))))
chart, TF, sequence, etc.
describe what you do to break it ))))
chart, TF, sequence, etc.