//+------------------------------------------------------------------+ //| VisualOpenOrderWithMM.mq4 | //| Itso | //| modified by teedaniel | | //| itso@dir.bg | //+------------------------------------------------------------------+ #property copyright "Itso" #property link "itso@dir.bg" #property show_inputs #include extern double Risk = 0.005; //+------------------------------------------------------------------+ //| script program start function | //+------------------------------------------------------------------+ int start() { //---- double MinLot = MarketInfo(Symbol(), MODE_MINLOT); double MaxLot = MarketInfo(Symbol(), MODE_MAXLOT); double Step = MarketInfo(Symbol(), MODE_LOTSTEP); double StopLoss = WindowPriceOnDropped(); double MoneyRisk = AccountFreeMargin() * Risk; double TickValue = MarketInfo(Symbol(), MODE_TICKVALUE); double PointLoss; double TProfit1; double TProfit2; double TProfit3; int cmd; double price; if(Ask>StopLoss) { //Open Long PointLoss = (Ask - StopLoss) / Point; TProfit1 = (Ask + 0.001); TProfit2 = (Ask + 0.0015); TProfit3 = (Ask + 0.003); cmd = OP_BUY; price = Ask; } else { //Open Short PointLoss = (StopLoss - Bid) / Point; TProfit1 = (Bid - 0.001); TProfit2 = (Bid - 0.0015); TProfit3 = (Bid - 0.003); cmd = OP_SELL; price = Bid; } double LotsRough = MoneyRisk / (TickValue * PointLoss); if(LotsRoughLotsRough) { Lots = CheckedLot - Step; break; } } Print("Lots=",Lots); int ticket = OrderSend(Symbol(), cmd, Lots, price, 30, StopLoss, TProfit1, 0); ticket = OrderSend(Symbol(), cmd, Lots, price, 30, StopLoss, TProfit2, 0); ticket = OrderSend(Symbol(), cmd, Lots, price, 30, StopLoss, TProfit3, 0); if (ticket<0) { Print("Error: ", ErrorDescription(GetLastError())); } //---- return(0); } //+------------------------------------------------------------------+