Skip to content
All library documents

MQL5 Control Flow Through an Inside and Outside Bar Indicator

Article MQL5 articles

Summary

This tutorial introduces Boolean expressions, comparisons, logical operators, conditional branches, loops, and switch-case statements through an MQL5 indicator that marks inside and outside bars. It explains how the indicator distinguishes completed candles from a forming candle, and how input settings can let users select which patterns to display. The placement of markers is presented as a design choice rather than a fixed convention.

Examples show how conditions control execution, how braces group multiple statements, and how operator precedence affects compound expressions. The tutorial also highlights common mistakes, including confusing assignment with equality comparison, and recommends using braces consistently to reduce errors. Its practical evidence is illustrative code and exercises rather than trading tests or performance analysis. The lesson is about programming logic and indicator construction; it does not claim that inside or outside bars predict price movements or establish a profitable trading strategy.

Key ideas

  • Boolean expressions and comparison operators provide the conditions used to make program decisions.
  • Use conditional statements and loops to select and repeat indicator calculations.
  • Curly braces group statements into a conditional block and help prevent unintended execution.
  • The example indicator marks selected completed inside and outside bars, while leaving the forming candle unmarked.
  • Marker placement and pattern selection are implementation choices, not evidence of trading value.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.