simulador win

[robo_win]

#property strict#include <Trade/Trade.mqh>CTrade trade;input double Lote=0.01;input double StopLossMoney=0.20;input double TakeProfitMoney=0.45;int hf,hs; datetime last=0;int OnInit(){hf=iMA(_Symbol,PERIOD_H1,9,0,MODE_EMA,PRICE_CLOSE); hs=iMA(_Symbol,PERIOD_H1,21,0,MODE_EMA,PRICE_CLOSE); return(INIT_SUCCEEDED);}void OnDeinit(const int r){IndicatorRelease(hf); IndicatorRelease(hs);}void OnTick(){if(PositionSelect(_Symbol)){double pr=PositionGetDouble(POSITION_PROFIT); if(pr<=-StopLossMoney || pr>=TakeProfitMoney) trade.PositionClose(_Symbol);} datetime ct=iTime(_Symbol,PERIOD_H1,0); if(ct==last) return; last=ct; if(PositionSelect(_Symbol)) return; double a[],b[]; if(CopyBuffer(hf,0,0,2,a)<2) return; if(CopyBuffer(hs,0,0,2,b)<2) return; ArraySetAsSeries(a,true); ArraySetAsSeries(b,true); if(a[0]>b[0] && a[1]<=b[1]) trade.Buy(Lote); if(a[0]<b[0] && a[1]>=b[1]) trade.Sell(Lote);}