Simthandile sim new indicator

MQL5 Indikatoren Konvertierung

Spezifikation

calcVolume(void)
  {
//---
   MqlRates rates[];

   if(CopyRates(_Symbol, PERIOD_CURRENT, startTime, endTime, rates) > 0)
     {
      double rangeHigh = rates[0].high, rangeLow = rates[0].low;
      int  count = MathAbs(iBarShift(_Symbol, PERIOD_CURRENT, startTime) -
                           iBarShift(_Symbol, PERIOD_CURRENT, endTime)) + 1;

      //---VERTICAL PRICE RANGE
      for(int b = 0; b < ArraySize(rates); b++)
        {
         if(rates[b].high > rangeHigh)
            rangeHigh = rates[b].high;

         if(rates[b].low < rangeLow)
            rangeLow = rates[b].low;
        }
      //--- SET ANALYSIS RANGE RECTANGLE PROPERLY
      ObjectSetDouble(0, _VOLUME_RANGE, OBJPROP_PRICE, 0, rangeHigh);
      ObjectSetDouble(0, _VOLUME_RANGE, OBJPROP_PRICE, 1, rangeLow);
      ChartRedraw();
      //--- ADAPTIVE BIN CONSTRUCTION
      int numberOfBins = int(count / 4);
      numberOfBins = MathMax(5, numberOfBins);
      double step = (rangeHigh - rangeLow) / numberOfBins;
      st_priceVolume bins[];
      ArrayResize(bins, numberOfBins);
      double binHigh = EMPTY_VALUE,  binLow = EMPTY_VALUE;
      bool useRealVol = (rates[0].real_volume > 0);

      //--- VOLUME ACCUMULATION USING SELECTED PRICE MODEL
      for(int w = 0; w < numberOfBins; w++)
        {
         binLow = rangeLow + step * w;
         binHigh = binLow + step;
         for(int c = 0; c < ArraySize(rates); c++)
           {
            if(getPrice(rates[c]) >= binLow && getPrice(rates[c]) <= binHigh)
              {
               bins[w].volume += (useRealVol) ? rates[c].real_volume : rates[c].tick_volume;
               bins[w].price = NormalizeDouble(getPrice(rates[c]), _Digits);
              }
           }        
        }
      //--- VOLUME EXTREMES
      long maxVol = 0, minVol = LONG_MAX;
      for(int b = 0; b < ArraySize(bins); b++)
        {
         if(bins[b].volume > maxVol)
            maxVol = bins[b].volume;

         if(bins[b].volume < minVol)
            minVol = bins[b].volume;
        }
      //--- PROFILE SCALING
      int extendBars = 0;
      int maxProfileLength =  int(count * 0.4);
      int minProfileLength = (int)MathRound(maxProfileLength * 0.05);
      minProfileLength = MathMax(2, minProfileLength);// CLAMP
      color clr = clrRed;
      double dominance = EMPTY_VALUE;
      //--- PROFILE RENDERING
      bool pocDrawn = false;
      for(int p = 0; p < ArraySize(bins); p++)
        {
         binLow = rangeLow + step * p;
         binHigh = binLow + step;

         extendBars = minProfileLength + (int)MathRound(normalizeMinMax(bins[p].volume, maxVol, minVol)
                      * (maxProfileLength - minProfileLength));
         dominance = (double)extendBars / maxProfileLength;
         clr = (dominance >= 0.8) ? clrBlue :
               (dominance >= 0.6) ? clrPurple :
               (dominance >= 0.5) ? clrBrown :
               (dominance >= 0.4) ? clrLime :
               (dominance >= 0.2) ? clrTeal :
               (dominance >= 0.15) ? clrBlueViolet :
               clrGray;

         createRect(_PROFILE + (string)p, startTime, binHigh, startTime + (PeriodSeconds()*extendBars), binLow, clr);
         if(bins[p].volume == maxVol && !pocDrawn)
           {
            //--- DRAW MAXIMUM VOLUME'S POC
            createHLine(_PROFILE_POC + (string)p, NormalizeDouble(bins[p].price, _Digits), clr, "POC");
            pocDrawn = true;
           }
        }
      ChartRedraw();
     }
  }

Initialization and Cleanup

Having established the supporting helper functions, we now implement the standard MQL5 event handlers, beginning with OnInit() and OnDeinit(). During initialization, the indicator creates the ON/OFF menu button, providing users with a convenient way to enable or disable the interactive Crosshair Volume Profile. Conversely, when the indicator is removed, the cleanup routine is executed to delete all indicator-generated chart objects and restore the chart's default interaction settings, ensuring the chart is left in a clean and consistent state.
//+------------------------------------------------------------------+
//|                   INITIALIZATION FUNCTION                        |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   createMenuButton();
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//|                  DEINITIALIZATION FUNCTION                       |
//+------------------------------------------------------------------+
void OnDeinit(const int32_t reason)
  {
//---
   clearChart();
  }

Iteration Engine (OnCalculate)

Unlike conventional indicators that recalculate whenever new market data arrives, this indicator is designed around user interaction rather than incoming candles. For this reason, the OnCalculate() function is intentionally left empty, simply returning rates_total to satisfy the standard MQL5 indicator interface. All Volume Profile computations are instead triggered by Crosshair-driven chart events, ensuring the indicator updates only when the user selects or modifies an analysis range. This event-driven approach aligns with the interactive nature of the indicator while avoiding unnecessary recalculations on every incoming tick or bar.

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int32_t rates_total,
                const int32_t 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 int32_t &spread[])
  {
//--- EMPTY
   return(rates_total);
  }

Interactive Engine

At the heart of the indicator is the OnChartEvent() function, which handles all chart events and drives the interactive behavior of the Crosshair Volume Profile. Rather than relying on incoming market data, the indicator responds to user actions such as button clicks, mouse movement, keyboard input, and right-click operations. This event-driven architecture enables users to interactively define an analysis range and generate the Volume Profile only when required.

//+------------------------------------------------------------------+
//|                      CHARTEVENT FUNCTION                         |
//+------------------------------------------------------------------+
void OnChartEvent(const int32_t id,
                  const long &lparam,
                  const double &dparam,
                  const string &sparam)
  {
//---
   st_priceVolume tp;
   static bool isDragging = false;
   int key = (int)lparam;
   static ulong lastClick = 0;
   switch(id)
     {
      case CHARTEVENT_OBJECT_CLICK:
         //--- TOGGLE MENU BUTTON
         if(sparam == _MENU_BUTTON)
           {
            toggleMenuButton();
           }
         break;
      case CHARTEVENT_KEYDOWN:
         //--- PROFILE DELETION: "C" DOUBLE-CLICK
         if(key == 67)
           {
            ulong now = GetTickCount();
            bool doubleClick = (now - lastClick <= 300);
            lastClick = now;
            if(doubleClick && ObjectFind(0, _VOLUME_RANGE) > -1)
              {
               ObjectsDeleteAll(0, _PROFILE);
               ObjectDelete(0, _VOLUME_RANGE);
               if(ObjectGetString(0, _MENU_BUTTON, OBJPROP_TEXT) == "ON")
                 {
                  toggleMenuButton();
                 }
               ChartRedraw();
              }
           }
         break;
      case CHARTEVENT_MOUSE_MOVE:
         if(isDragging)
           {
            //--- UPDATE OBJECTS ALONG THE CURSOR POSITION USING getCursorPriceTime()
            tp = getCursorPriceTime((short)lparam, (short)dparam);
            tp.time = (tp.time >= iTime(_Symbol, PERIOD_CURRENT, 0)) ?
                      iTime(_Symbol, PERIOD_CURRENT, 1) : tp.time;
            ObjectMove(0, _V_END_LINE, 0, tp.time, 0);
            ObjectMove(0, _H_LINE, 0, 0, tp.price);
            ObjectMove(0, _VOLUME_RANGE, 1, tp.time, tp.price);
            endTime = tp.time;
            ChartRedraw();
           }
         //--- RIGHT-CLICK
         if(((uchar)sparam & MOUSE_RIGHT) != 0)
           {
            tp = getCursorPriceTime((short)lparam, (short)dparam);

            if(!isDragging)
              {
               //--- CREATE CROSSHAIR
               isDragging = true;
               color clr = (color)ChartGetInteger(0, CHART_COLOR_BACKGROUND);
               ObjectsDeleteAll(0, _PROFILE);
               ChartRedraw();
               startTime = tp.time;
               createVLine(_V_START_LINE, tp.time);
               createVLine(_V_END_LINE, 0);
               createHLine(_H_LINE, 0, (clr == clrBlack) ?
                           clrWhite : clrBlack);
               //--- POSITION RECTANGLE ANCHOR (0) AT THE HIGH OF BAR AT RIGHT-CLICK POSITION
               int index = iBarShift(_Symbol, PERIOD_CURRENT, tp.time);
               double price = iHigh(_Symbol, PERIOD_CURRENT, index);
               createRect(_VOLUME_RANGE, tp.time, price, 0, 0, clrOldLace, "ANALYSIS RANGE");
               ChartRedraw();
              }
           }
         else
           {
            //--- RIGHT-CLICK RELEASE
            if(isDragging)
              {
               //--- DELETE CROSSHAIR
               ObjectDelete(0, _V_START_LINE);
               ObjectDelete(0, _V_END_LINE);
               ObjectDelete(0, _H_LINE);
               ChartRedraw();
               isDragging = false;
               //--- RENDER VOLUME PROFILE
               calcVolume();
              }
           }
         break;

Bewerbungen

1
Entwickler 1
Bewertung
(395)
Projekte
556
41%
Schlichtung
30
57% / 3%
Frist nicht eingehalten
57
10%
Frei
Veröffentlicht: 11 Beispiele
2
Entwickler 2
Bewertung
(1)
Projekte
3
0%
Schlichtung
0
Frist nicht eingehalten
0
Frei
3
Entwickler 3
Bewertung
(1)
Projekte
1
0%
Schlichtung
1
0% / 100%
Frist nicht eingehalten
0
Frei
4
Entwickler 4
Bewertung
(175)
Projekte
187
47%
Schlichtung
3
33% / 33%
Frist nicht eingehalten
1
1%
Beschäftigt
5
Entwickler 5
Bewertung
(8)
Projekte
8
0%
Schlichtung
2
50% / 0%
Frist nicht eingehalten
1
13%
Arbeitet
6
Entwickler 6
Bewertung
(1)
Projekte
1
0%
Schlichtung
0
Frist nicht eingehalten
0
Frei
7
Entwickler 7
Bewertung
(7)
Projekte
9
33%
Schlichtung
0
Frist nicht eingehalten
1
11%
Beschäftigt
Veröffentlicht: 1 Beispiel
8
Entwickler 8
Bewertung
(12)
Projekte
13
62%
Schlichtung
0
Frist nicht eingehalten
0
Frei
9
Entwickler 9
Bewertung
(1)
Projekte
1
0%
Schlichtung
0
Frist nicht eingehalten
1
100%
Frei
10
Entwickler 10
Bewertung
(1)
Projekte
1
0%
Schlichtung
1
0% / 100%
Frist nicht eingehalten
0
Arbeitet
11
Entwickler 11
Bewertung
(3)
Projekte
9
67%
Schlichtung
0
Frist nicht eingehalten
0
Arbeitet
12
Entwickler 12
Bewertung
Projekte
0
0%
Schlichtung
0
Frist nicht eingehalten
0
Frei
13
Entwickler 13
Bewertung
Projekte
0
0%
Schlichtung
0
Frist nicht eingehalten
0
Frei
14
Entwickler 14
Bewertung
Projekte
0
0%
Schlichtung
0
Frist nicht eingehalten
0
Frei
15
Entwickler 15
Bewertung
(3)
Projekte
4
0%
Schlichtung
1
100% / 0%
Frist nicht eingehalten
1
25%
Frei
16
Entwickler 16
Bewertung
Projekte
0
0%
Schlichtung
0
Frist nicht eingehalten
0
Frei
17
Entwickler 17
Bewertung
Projekte
0
0%
Schlichtung
0
Frist nicht eingehalten
0
Frei
18
Entwickler 18
Bewertung
(2675)
Projekte
3414
68%
Schlichtung
77
48% / 14%
Frist nicht eingehalten
342
10%
Frei
Veröffentlicht: 1 Beispiel
19
Entwickler 19
Bewertung
(2)
Projekte
2
50%
Schlichtung
0
Frist nicht eingehalten
0
Frei
20
Entwickler 20
Bewertung
Projekte
0
0%
Schlichtung
0
Frist nicht eingehalten
0
Frei
21
Entwickler 21
Bewertung
Projekte
0
0%
Schlichtung
0
Frist nicht eingehalten
0
Frei
Ähnliche Aufträge
can you help me with I have an indicator that I built and I work with PickMyTrade. The entries come through the alerts I get from Trading View . Trading View needs to send an alert and PickMyTrade executes a trade at that exact same second. Now, I have a problem in Trading View with the synchronization between the alert and the signal. I have a box that I built for a trade. It needs to output the box and get an
Looking for a developer in NinjaTrader For coding Inst - ES,NQ Chart type - Tick, range, volume & time Brief- Fib levels mapped on chart which act as entries, tgts and stops all based on candle close. (Maybe) use MACD for filtering direction. Daily manual input of the TWO fib Anchor levels is part of the strategy. I need a well experienced developer to bid and before biding check the attached file well. the PDF and
ROBOTFORX_V7 40+ USD
i have the robotforx_v7 code but am looking for an experinced developer to improve my code i want it to capture quick moves on 5mins it should be able close like ten trades in small profits
I will pay 2500 to 10000 USD (negotiable) for one MT5 Expert Advisor, built properly. One robot done right, not a batch of cheap jobs. I have a strategy I believe in and a rough draft robot I built myself. The logic is there. The execution is not. That last part is outside my expertise, which is why I am hiring instead of continuing on my own. I am open to feedback on the strategy itself. If you see something in it
I Have an existing Mql5 Expert advisor (source code), I want a professional programmer to help me Modify the EA... so that it can stop taking new trades once it Gets to a Pacific Lots Size or Floating loss
Wise Legend 30 - 500 USD
I want this robot to alert me on a good entry point on the trading flat form ether to buy or to sell. And also alert me when to close the market. And alert me on market continuations
I am looking for a programmer that can develop an MT4 indicator that shows COT DATA For Forex, indices and and metals. The indicator must be an oscillator or any other form that would work well in that format. It doesn't need to show all pairs at once, it can show only for current chart. Let's talk
Does anyone know of an indicator that show when volume is high and instations are evolved in thr market and when they are not. Am speaking about gold and forex not stocks. Please don't apply if you don't have knowledge about anything related to what I asked for
I am looking for a professional and market-savvy MQL developer to build a disciplined, stable Scalping Expert Advisor (EA). The ideal developer must have a solid understanding of Trend Identification, Fibonacci Levels, and Technical Indicators , alongside strict risk management implementation. Key Focus Areas & Developer Requirements: Market & Analysis Expertise: ⚬ Deep understanding of Trend direction (Market
Looking for an experienced MQL4 developer to restore functionality for an MT4 Expert Advisor I've used for 3 years. The software is showing a startup validation error, and I cannot reach the original developer. I'll provide all necessary files and proof of ownership. I don't have the code source just the .ex4 file. Scope of work: - Diagnose the startup validation error of the Expert Advisor - Restore normal

Projektdetails

Budget
40 - 300 USD
Ausführungsfristen
von 1 bis 10 Tag(e)

Kunde

Veröffentlichte Aufträge1
Anzahl der Schlichtungen0