Indicator-handle validity and buffer-copy results are not checked before array access.
Ichimoku Cross with ATR Exits
Trades Tenkan/Kijun crosses using daily ATR to set the stop and target distances.
How the source is structured
- Read two completed H1 values of the Tenkan and Kijun lines.
- Buy on an upward cross and sell on a downward cross.
- Calculate exit distances from the previous daily ATR value.
Default inputs
| Volume | 0.1 lot |
|---|---|
| Tenkan / Kijun / Span B | 9 / 21 / 52 |
| ATR period | D1 / 14 |
| Stop / target ATR factors | 1.0 / 1.0 |
Source-review notes
These observations come from reading this uploaded version. They are not compiler output or a complete code audit. The download retains the source as supplied.
There is no open-position guard or magic-number setup. The sell target is based on ask while the sell stop and entry use bid.
Only the Tenkan/Kijun cross is used; the source does not implement a cloud-position filter.
Dependencies
Built-in Ichimoku and ATR indicators; MetaTrader 5 standard Trade library.
Source & attribution
The original filename includes 'Rene'; the source contains no author or license declaration.
Included in the Edge Quant source collection with existing notices preserved. Free download does not imply a new license grant.
Inspect the original source
The browser preview is decoded for reading; the download keeps the original file bytes.
Expand full MQL5 source · 59 lines
#include <Trade/Trade.mqh>input double Lots = 0.1;input double AtrSLFactor = 1.0;input double AtrTpFactor = 1.0;input ENUM_TIMEFRAMES IchiTimeframe = PERIOD_H1;input int IchiTenkanSen = 9;input int IchiKijunSen = 21;input int IchiSenkouSpanB = 52;input ENUM_TIMEFRAMES AtrTimeframe = PERIOD_D1;input int AtrPeriods = 14;CTrade trade;int handleIchimoku, handleAtr;datetime timestamp;int OnInit(){ handleIchimoku = iIchimoku(_Symbol,IchiTimeframe,IchiTenkanSen,IchiKijunSen,IchiSenkouSpanB); handleAtr = iATR(_Symbol,AtrTimeframe,AtrPeriods); return(INIT_SUCCEEDED);}void OnDeinit(const int reason){}void OnTick(){ datetime time0 = iTime(_Symbol,IchiTimeframe,0); if(time0 != timestamp){ timestamp = time0; double tenkanSen[], kijunSen[]; CopyBuffer(handleIchimoku,TENKANSEN_LINE,1,2,tenkanSen); CopyBuffer(handleIchimoku,KIJUNSEN_LINE,1,2,kijunSen); double atr[]; CopyBuffer(handleAtr,MAIN_LINE,1,1,atr); double ask = SymbolInfoDouble(_Symbol,SYMBOL_ASK); double bid = SymbolInfoDouble(_Symbol,SYMBOL_BID); if(tenkanSen[1] > kijunSen[1] && tenkanSen[0] <= kijunSen [0]){ double sl = ask - atr[0] * AtrSLFactor; double tp = ask + atr[0] * AtrTpFactor; trade.Buy(Lots,_Symbol,ask,sl,tp,"Ichi Buy"); }else if(tenkanSen[1] < kijunSen[1] && tenkanSen[0] > kijunSen[0]){ double sl = bid + atr[0] *AtrSLFactor; double tp = ask - atr[0] *AtrTpFactor; trade.Sell(Lots,_Symbol,bid,sl,tp,"Ichi Sell"); } }}Educational source material, not investment advice. No profitability, execution quality or live-readiness claim is made for this upload.