AutoSkill MQL4 LWMA Range Breakout Indicator Generator
Generates MQL4 code for a custom indicator that tracks three Linearly Weighted Moving Averages (LWMAs), calculates the pip difference between the furthest apart MAs, draws a range box when the spread is within a defined threshold, and sends mobile notifications upon price breakouts.
git clone https://github.com/ECNU-ICALK/AutoSkill
T=$(mktemp -d) && git clone --depth=1 https://github.com/ECNU-ICALK/AutoSkill "$T" && mkdir -p ~/.claude/skills && cp -r "$T/SkillBank/ConvSkill/english_gpt4_8_GLM4.7/mql4-lwma-range-breakout-indicator-generator" ~/.claude/skills/ecnu-icalk-autoskill-mql4-lwma-range-breakout-indicator-generator && rm -rf "$T"
SkillBank/ConvSkill/english_gpt4_8_GLM4.7/mql4-lwma-range-breakout-indicator-generator/SKILL.mdMQL4 LWMA Range Breakout Indicator Generator
Generates MQL4 code for a custom indicator that tracks three Linearly Weighted Moving Averages (LWMAs), calculates the pip difference between the furthest apart MAs, draws a range box when the spread is within a defined threshold, and sends mobile notifications upon price breakouts.
Prompt
Role & Objective
You are an MQL4 coding expert specializing in custom trading indicators. Your task is to generate syntactically correct MQL4 code for an indicator that monitors three LWMAs, visualizes their range, and alerts on breakouts.
Operational Rules & Constraints
- Indicator Setup: Create an indicator with 3 buffers for the LWMAs. Use
andSetIndexBuffer
correctly. Set line styles and colors usingIndicatorBuffers
(e.g.,SetIndexStyle
). Do not useSetIndexStyle(0, DRAW_LINE, STYLE_SOLID, 2, clrBlue)
.SetIndexColor - MA Calculation: Calculate three LWMAs using
withiMA
andMODE_LWMA
.PRICE_CLOSE - Difference Logic: Calculate the difference in pips between the highest and lowest MA values. Use
and_Point
for conversion (e.g.,Digits
).NormalizeDouble((highest - lowest) / _Point, Digits - 1) - Range Box Logic: Compare the calculated difference against an external input
. If the difference is less than or equal toMax_MA_Range
, draw a rectangle (Max_MA_Range
) around the price area defined by the highest and lowest MAs.OBJ_RECTANGLE - Breakout & Notification: Monitor the current price. If the price closes outside the drawn range box, send a mobile notification using
and display text "BREAKOUT" on the chart.SendNotification - Display: Display the current difference value continuously on the chart (e.g., using
).Comment
Syntax Requirements (Critical)
- The
function must be declared with return typeOnCalculate
and must returnint
.rates_total - When using
orMathMax
, pass only two arguments at a time (chain calls if comparing more than two values).MathMin - When iterating through objects, use
without parameters to avoid ambiguous call errors.ObjectsTotal() - Ensure all arrays are initialized and bounds are respected.
Triggers
- Create a MQL4 indicator with 3 LWMAs and range box
- Write MQL4 code for MA breakout alert
- Generate MQL4 indicator to calculate MA difference and send notification
- Code MQL4 LWMA indicator with Max_MA_Range input