Incorporate an array into fractals

MQL4 지표 컨설팅

작업 종료됨

실행 시간 31 분
고객의 피드백
Fantastic. Quick, efficient and even annotated the script so i could follow it more easily. 5 stars.
피고용인의 피드백
Great customer from the Great Britain.

명시

I've been working on other things but over the past month been back and forward with this. 

I need to store fractals in an array to compare them. 

Recent fractal lower than last fractal and last fractal higher than third last fractal. Plot a buffer on the middle fractal.

The same for low fractals.

(image included).

So the dots are fractals that plot fine if a fractal has a higher/lower pair of fractals either side plot another buffer on it.

The fractal indicator i have works fine i just want to add this extra feature to make it clearer when trend changes direction.

So store last three fractal values and compare them. I don't want to use Ifractals as that limits me to only 2 bars either side of the fractal.

Code is below:

#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Red
#property indicator_color2 Blue
#property indicator_color3 Yellow

//---- input parameters

//---- buffers
double ExtUpFractalsBuffer[];
double ExtDownFractalsBuffer[];
double TOP[];


double UP_ARRAY[3];
double DOWN_ARRAY[3];


//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicator buffers mapping  
    SetIndexBuffer(0,ExtUpFractalsBuffer);
    SetIndexBuffer(1,ExtDownFractalsBuffer); 
    SetIndexBuffer(2,TOP);
 
//---- drawing settings
    SetIndexStyle(0,DRAW_ARROW);
    SetIndexArrow(0,119);
    SetIndexStyle(1,DRAW_ARROW);
    SetIndexArrow(1,119);
    SetIndexStyle(2, DRAW_ARROW,0,4);
    SetIndexArrow(2,119);

//----
    SetIndexEmptyValue(0,0.0);
    SetIndexEmptyValue(1,0.0);
    SetIndexEmptyValue(2,0.0);

//---- name for DataWindow
    SetIndexLabel(0,"Fractal Up");
    SetIndexLabel(1,"Fractal Down");
    SetIndexLabel(2, "TOP");

    

//---- initialization done   
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- TODO: add your code here
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    i,nCountedBars;
   bool   bFound;
   double dCurrent;
   nCountedBars=IndicatorCounted();
//---- last counted bar will be recounted    
   if(nCountedBars<=2)
      i=Bars-nCountedBars-3;
   if(nCountedBars>2)
     {
      nCountedBars--;
      i=Bars-nCountedBars-1;
     }      
          
//----Up and Down Fractals
   while(i>=2)
     {
      //----Fractals up
      bFound=false;
      dCurrent=Close[i];
      
        if(dCurrent>Close[i+1] && dCurrent>Close[i-1])
        {
         bFound=true;
         ExtUpFractalsBuffer[i]=dCurrent;
         
         
         int TotalUp =3;
     for(int j=TotalUp-1;j>=0;j--)
     {
      if(ExtUpFractalsBuffer[i]!=0)
        {
         UP_ARRAY[j]=dCurrent;
         UP_ARRAY[j]=UP_ARRAY[j-1]; 
        }
     }
        if(UP_ARRAY[0]<UP_ARRAY[1] && UP_ARRAY[1]>UP_ARRAY[2])
        {
         TOP[i]=dCurrent;
         }
        }
      
                                         

      //----Fractals down
      bFound=false;
      dCurrent=Close[i];
      if(dCurrent<Close[i+1] && dCurrent<Close[i-1] )
        {
        bFound=true;
        ExtDownFractalsBuffer[i]=dCurrent;
        
        }                                   
      i--;
     }
     //----------------
    
     //----------------
     return(0);
     }

The yellow is the array and plotting buffer part I've had a shot at but no luck.

If you could make it run and perhaps a brief summary of these sections and how you got it to work so i can learn from it.

Thank you in advance.

Torexvir

응답함

1
개발자 1
등급
(556)
프로젝트
850
61%
중재
33
27% / 45%
기한 초과
24
3%
무료
게재됨: 1 코드
2
개발자 2
등급
(499)
프로젝트
744
56%
중재
48
31% / 31%
기한 초과
120
16%
무료
게재됨: 1 코드
3
개발자 3
등급
(51)
프로젝트
66
30%
중재
2
0% / 0%
기한 초과
0
무료
비슷한 주문
‎A trending candle followed by a smaller trending candle which is the second candle with no 5EMA ‎ ‎The 3rd candle is a reversal candle in which it and it's immidiate previous candle must be at least 70% of each other's body or equal body, with no 5EMA touch ‎ ‎the 3rd candle candle is followed immediately by the 4th candle which is the signal candle in which it and the 1st cabdle must be also at least 70% of
LynxMT5algo 30 - 100 USD
An mt5 add on indicator like gainalgo style to show entrance and exit areas for gold silver and Btc scalping. It will be used to make trading more easy for beginners
I have the Fisher Indicator shown below the chart. I need an alert added for when the Fisher Indicator hits the 50 point at the end of each period. GBPUSD and EURUSD 4H charts are provided and I can provide additional
Hello here, I need someone who can work on pinescript and also with Renko charts. My entries for my strategy would be based on stop orders Kindly let me know if you can work on this for me and i will send necessary file and quote in the chat
Freelance Task — EA Recovery Layer Hello. I have a ready-made MQL5 EA. The signals, SL/TP and lot calculation should essentially not be touched. I need a recovery system added. I am not a programmer — below is how the robot should behave. What stays Entry only from an EA signal. Stop-loss is not a new signal. Trailing is already built into my EA — recovery does not implement its own trailing. If trailing is disabled
# SNRZ BOT — SESSION PROGRESS LOG Last updated: 2026-09-16 (local late-evening session) ## SAN BOT (new — cloned from SNRZ) - `MQL5\Experts\AutomatedOrderBot_SAN.mq5` / `.ex5` — v1.0, compiled 0 errors/0 warnings - Signal source: custom indicator "SAN" (InpSANName, buy buf 0 / sell buf 1, target bar 1), same SNRZ-style read, MA fallback if missing - Magic number 234567 (separate from SNRZ 123456 so both bots can run
Should be as it but no alarms, also we need to add a deep search so he can see all the preves candles and a memory function so its not slowing down the indicator. for higher time frames daily 4h 1h around 365 days and for lower time frames we do up to 20k bars but both flexible so i can change it later. the memory is important so the indicator is not always recalculating everything when a new candle shows especially
Hi, I need an experienced NinjaTrader 8/NinjaScript developer to finish or rebuild an automated futures strategy, ideally by the end of this week. I already have the complete TradingView Pine Script reference strategy, an existing ~2,000-line NinjaScript implementation, Playback logs, and known historical benchmark trades. MOST IMPORTANT REQUIREMENT: TRADINGVIEW ↔ NINJATRADER PARITY. The Pine Script is the reference
I need a custom MQL5 indicator for MetaTrader 5. The indicator must automatically print entry, stop loss, and take profit zones on the chart using dots. A critical requirement is that these dots must be non-lagging and absolutely non-repainting. Additionally, the indicator needs to identify and display current supply and demand zones. Please provide the mq5 source code and the ex5 file upon completion
I need an experienced trading-data specialist who can help me obtain 3–4 years of historical market data compatible with NinjaTrader 8 . The data will be used for trading strategy development, backtesting, and analysis

프로젝트 정보

예산
30+ USD
기한
로 4 일