A buffer for what ? the spread ?
is it possible to set buffer for ObjectSetText , because i want to use this buffer for alert , when candle crosses above or below (---------------------------------) this text area .
or can you share fixed horizontal level at virtually midpoint chart, same as subwindow 50 level
is it possible to set buffer for ObjectSetText , because i want to use this buffer for alert , when candle crosses above or below (---------------------------------) this text area .
or can you share fixed horizontal level at virtually midpoint chart, same as subwindow 50 level
Ow so you want the alert, not to display the history , you want one price .
Which price though ? the user adds it ?
Ow so you want the alert
actually i want this type fixed level indicator, see screenshot , this level same as subwindow 20, 50, 80 level, this levels doesn't move by chart shift, i added this by stochastic indicator modified by seperate window to chart window, but i want to add arrow or alert when candle cross this level, do you have this type idea indicator?
actually i want this type fixed level indicator, see screenshot , this level same as subwindow 20, 50, 80 level, this levels doesn't move by chart shift, i added this by stochastic indicator modified by seperate window to chart window, but i want to add arrow or alert when candle cross this level, do you have this type idea indicator?
or i have also a indicator , is it possible fixed level at vertically midpoint on chart
#property indicator_chart_window #property indicator_buffers 1 #property indicator_color1 clrRed input double levelPrice = 1.2000; // Set the desired level price here double buffer[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { // Indicator buffer SetIndexBuffer(0, buffer); // Set the buffer values to the desired level for (int i = 0; i < ArraySize(buffer); i++) { buffer[i] = levelPrice; } IndicatorShortName("Horizontal Level"); 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[]) { // Just refresh the buffer values on each tick for (int i = 0; i < rates_total; i++) { buffer[i] = levelPrice; } return(rates_total); } //+------------------------------------------------------------------+
actually i want this type fixed level indicator, see screenshot , this level same as subwindow 20, 50, 80 level, this levels doesn't move by chart shift, i added this by stochastic indicator modified by seperate window to chart window, but i want to add arrow or alert when candle cross this level, do you have this type idea indicator?
Ow so you want 3 % (levels) of the active viewport visible as the viewport changes ?
Or based on the previous "OtherTimeframe" close (or OHLC)?
Ow so you want 3 % (levels) of the active viewport visible as the viewport changes ?
Or based on the previous "OtherTimeframe" close (or OHLC)?
yes, is it possible to fixed the levelprice auto adjust vertically middle point on the chart
#property indicator_chart_window #property indicator_buffers 1 #property indicator_color1 clrRed input double levelPrice = 1.2000; // want to auto adjust vertically middle point on the chart double buffer[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { // Indicator buffer SetIndexBuffer(0, buffer); // Set the buffer values to the desired level for (int i = 0; i < ArraySize(buffer); i++) { buffer[i] = levelPrice; } IndicatorShortName("Horizontal Level"); 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[]) { // Just refresh the buffer values on each tick for (int i = 0; i < rates_total; i++) { buffer[i] = levelPrice; } return(rates_total); } //+------------------------------------------------------------------+
yes, is it possible to fixed the levelprice auto adjust vertically middle point on the chart
i see , try this
//+------------------------------------------------------------------+ //| chartVisualLevels.mq4 | //| Copyright 2023, MetaQuotes Ltd. | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2023, MetaQuotes Ltd." #property link "https://www.mql5.com" #property version "1.00" #property strict #property indicator_chart_window #define LINE_TAG "VisualLevels_" input double Level1=0.80;//Level 1 % input double Level2=0.50;//Level 2 % input double Level3=0.20;//Level 3 % bool Ready=false; double Levels[]; int OnInit() { Ready=false; ArrayFree(Levels); ArrayResize(Levels,3,0); Levels[0]=Level1; Levels[1]=Level2; Levels[2]=Level3; ObjectsDeleteAll(ChartID(),LINE_TAG); //create lines create_lines(Levels,Ready); 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[]) { //--- //--- return value of prev_calculated for next call return(rates_total); } //+------------------------------------------------------------------+ //| ChartEvent function | //+------------------------------------------------------------------+ void OnChartEvent(const int id, const long &lparam, const double &dparam, const string &sparam) { //--- if(id==CHARTEVENT_CHART_CHANGE){ create_lines(Levels,Ready); } } //+------------------------------------------------------------------+ //create lines void create_lines(double &levels[], bool &ready){ int errors=0;ResetLastError(); double max=(double)ChartGetDouble(ChartID(),CHART_PRICE_MAX,0);errors+=GetLastError();ResetLastError(); double min=(double)ChartGetDouble(ChartID(),CHART_PRICE_MIN,0);errors+=GetLastError();ResetLastError(); if(errors==0){ for(int i=0;i<ArraySize(levels);i++){ double price=NormalizeDouble((min+(max-min)*levels[i]),_Digits); if(!ready){ createHLine(LINE_TAG+IntegerToString(i),price); } else{ updateHLine(LINE_TAG+IntegerToString(i),price); } } ready=true; } } //create line void createHLine(string name, double price){ ObjectCreate(ChartID(),name,OBJ_HLINE,0,0,price); } //update line void updateHLine(string name, double price){ ObjectSetDouble(ChartID(),name,OBJPROP_PRICE,price); }
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use