Code Library / Ichimoku
MQL5 Ichimoku EA
Ichimoku EA trading TK cross with cloud confirmation.
Language: MQL5 · Category: Ichimoku · Tags: Ichimoku, EA, MQL5, TK cross, cloud trading
Source code
#include <Trade/Trade.mqh>
CTrade trade; input double Lots=0.1;
void OnTick() {
double t[],k[],sA[],sB[]; int h=iIchimoku(_Symbol,PERIOD_CURRENT,9,26,52);
CopyBuffer(h,0,0,3,t); CopyBuffer(h,1,0,3,k);
CopyBuffer(h,2,0,1,sA); CopyBuffer(h,3,0,1,sB);
double bid=SymbolInfoDouble(_Symbol,SYMBOL_BID);
if(t[1]<=k[1]&&t[0]>k[0]&&bid>sA[0]&&bid>sB[0]&&PositionsTotal()==0)
trade.Buy(Lots,_Symbol,SymbolInfoDouble(_Symbol,SYMBOL_ASK),k[0],0,"Ichi");
IndicatorRelease(h);
}How to use this snippet
This is a building block, not a finished trading system. Paste it into your own MQL5 project, compile it, and test it on a demo account with your broker's real spreads before relying on it. If MetaEditor reports errors, the compilation error fixer can help.