----
*一般にEAはインディケーターを使って売買シグナルを点灯させる
*====EA例=====----<pre>#property strict input int FastMAPeriod = 10;input int SlowMAPeriod = 40;input double Lots = 0.1; int Ticket = 0; int OnInit() { return(INIT_SUCCEEDED); }void OnDeinit(const int reason) { }void OnTick() { double FastMA1 = iMA(_Symbol, 0, FastMAPeriod, 0, MODE_SMA, PRICE_CLOSE, 1); double SlowMA1 = iMA(_Symbol, 0, SlowMAPeriod, 0, MODE_SMA, PRICE_CLOSE, 1); double FastMA2 = iMA(_Symbol, 0 ,FastMAPeriod, 0, MODE_SMA, PRICE_CLOSE, 2); double SlowMA2 = iMA(_Symbol, 0, SlowMAPeriod, 0, MODE_SMA, PRICE_CLOSE, 2); int pos = 0; if (OrderSelect(Ticket, SELECT_BY_TICKET) && OrderCloseTime() == 0) { if (OrderType() == OP_BUY) { pos = 1; } if (OrderType() == OP_SELL) { pos = -1; } } bool ret; if (FastMA2 <= SlowMA2 && FastMA1 > SlowMA1) { if (pos < 0) { ret = OrderClose(Ticket, OrderLots(), OrderClosePrice(), 0); if (ret) { pos = 0; } } if (pos == 0) { Ticket = OrderSend(_Symbol, OP_BUY, Lots, Ask, 0, 0, 0); } } if (FastMA2 >= SlowMA2 && FastMA1 < SlowMA1) { if (pos > 0) { ret = OrderClose(Ticket, OrderLots(), OrderClosePrice(), 0); if (ret) { pos = 0; } } if (pos == 0) { Ticket = OrderSend(_Symbol, OP_SELL, Lots, Bid, 0, 0, 0); } } }</pre>
====バックテスト====
----