//+------------------------------------------------------------------+ //| High&Low.mq4 | //| Copyright © 2007, Shadow Trader | //| e-mail: ShadowTrader@fxmail.ru | //+------------------------------------------------------------------+ // Ýêñïåðò ïðåäíàçíà÷åí äëÿ ðàáîòû íà äíåâêàõ. // Ïàðàìåòðû óñòàíîâëåíû äëÿ ïàðû EURUSD extern int ma_period = 20; extern double SL_percent_of_channel = 2.1; double lots = 0.1; double sl; double tp; int init () { return(0); } int deinit() { return(0); } int day=1; int start() { if (AccountFreeMargin() < 120) return (0); double mah = iMA(Symbol(), 0, ma_period, 0, MODE_LWMA, PRICE_HIGH, 1); double mal = iMA(Symbol(), 0, ma_period, 0, MODE_LWMA, PRICE_LOW, 1); if (OrdersTotal() > 0) { if (Volume[0]>day) return (0); else { for (int i = 0; i < OrdersTotal(); i++) { if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES) == TRUE) { if (OrderType() == OP_BUY) { if (OrderStopLoss() < mal) OrderModify(OrderTicket(), Ask, mal, OrderTakeProfit(), 0, Gold); } if (OrderType() == OP_SELL) { if (OrderStopLoss() > mah) OrderModify(OrderTicket(), Bid, mah, OrderTakeProfit(), 0, Green); } } } return (0); } } // Ïîêóïêà if ( Close[1] > mah && Low [0] > mah ) { sl = Ask-SL_percent_of_channel*(mah-mal); tp = Ask + (mah - mal); OrderSend(Symbol(), OP_BUY, lots, Ask, 3, sl, tp, "", 0, 0, Blue); } // Ïðîäàæà if ( Close[1] < mal && High[0] < mal ) { sl = Bid+SL_percent_of_channel*(mah-mal); tp = Bid - (mah - mal); OrderSend(Symbol(), OP_SELL, lots, Bid, 3, sl, tp, "", 0, 0, Red); } return(0); }
Sample
Analysis
Market Information Used:
Series array that contains tick volumes of each bar
Series array that contains close prices for each bar
Series array that contains the highest prices of each bar
Indicator Curves created:
Indicators Used:
Moving average indicator
Custom Indicators Used:
Order Management characteristics:
Checks for the total of open orders
It can change open orders parameters, due to possible stepping strategy
It automatically opens orders when conditions are reached
Other Features: