Mohammad Dehghani:
Sequence: We need at least 3 consecutive candles of the same color (Bullish or Bearish). More than 3 is also acceptable.
Sequence: We need at least 3 consecutive candles of the same color (Bullish or Bearish). More than 3 is also acceptable.
You seem to have a large amount of code that is somewhat convoluted. I would take it from the top and focus on identifying the 3 bar pattern for starters. Perhaps this indicator's code will help:
Files:
3_bar_swing.mq4
4 kb
3_bar_swing_v2.mq4
5 kb
Here's another indicator that is likely more aligned with your bar pattern.
For your purposes, you should replace:
if ((CloseBar3 < OpenBar3) && (CloseBar2 < OpenBar2) && (CloseBar1 > OpenBar1)) with:
if ((CloseBar3 < CloseBar2) && (CloseBar2 < CloseBar1)) and do the same for up bar conditions.
Based on your OP, you need to compare Lows for down bars/Highs for up bars as well. Just add the Low/High-supporting code throughout the indicator code.
Files:
3barPattern2.mq4
15 kb
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello everyone,
I am posting this request again because I previously asked a similar question but unfortunately didn't reach a solution. I am working on a custom indicator for MQL4 based on a "Spike" and "P-Gap" strategy, but the code is not behaving according to my defined logic.
I would really appreciate it if someone could review my code and point out where the logic is flawed or what needs to be corrected and how should be corrected to match the rules below.
Here is the exact logic of the strategy:
1. Spike Identification:
2. Entry & Trade Management:
The Problem:
Currently, the indicator does not correctly identify the setup or place the signals based on these exact conditions.
Could you please take a look at the attached code and guide me on which part needs to be modified? Your help would be a huge lifesaver for me as I have been stuck on this for a while I attacked a screen shot of correct signal.
Thank you very much in advance!