VisualOpenOrderWithMM





//+------------------------------------------------------------------+
//|                                        VisualOpenOrderWithMM.mq4 |
//|                                                             Itso |
//|                                                      itso@dir.bg |
//+------------------------------------------------------------------+
#property copyright "Itso"
#property link      "itso@dir.bg"
#property show_inputs
#include <stdlib.mqh>

extern double Risk = 0.05;

//+------------------------------------------------------------------+
//| 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;
   int cmd;
   double price;
   if(Ask>StopLoss)
   {
      //Open Long
      PointLoss = (Ask - StopLoss) / Point;
      cmd = OP_BUY;
      price = Ask;
   }
   else
   {
      //Open Short
      PointLoss = (StopLoss - Bid) / Point;
      cmd = OP_SELL;
      price = Bid;
   }

   double LotsRough = MoneyRisk / (TickValue * PointLoss);
   if(LotsRough<MinLot)
   {
      Print("Error. You don\'t have enough money!");
      return(0);
   }
   
   double Lots = MaxLot;
   for(double CheckedLot=MinLot; CheckedLot<=MaxLot; CheckedLot+=Step)
   {
      if(CheckedLot>LotsRough)
      {
         Lots = CheckedLot - Step;
         break;
      }
   }
   
   Print("Lots=",Lots);
   
   int ticket = OrderSend(Symbol(), cmd, Lots, price, 3, StopLoss, 0);
   if (ticket<0)
   {
      Print("Error: ", ErrorDescription(GetLastError()));
   }
//----
   return(0);
  }
//+------------------------------------------------------------------+



Sample





Analysis



Market Information Used:



Indicator Curves created:


Indicators Used:



Custom Indicators Used:

Order Management characteristics:
It automatically opens orders when conditions are reached

Other Features:


BackTest : EURUSD on H1

From 2009-08-01 to 2009-10-01 Profit Factor:0.00 Total Net Profit:0.00

BackTest : EURUSD on H1

From 2009-12-01 to 2010-01-17 Profit Factor:0.00 Total Net Profit:0.00

BackTest : EURUSD on H1

From 2010-04-01 to 2010-04-30 Profit Factor:0.00 Total Net Profit:0.00

BackTest : EURUSD on H1

From 2010-05-01 to 2010-05-31 Profit Factor:0.00 Total Net Profit:0.00

BackTest : EURUSD on H1

From 2010-06-01 to 2010-06-30 Profit Factor:0.00 Total Net Profit:0.00

BackTest : GBPUSD on H1

From 2010-01-01 to 2010-02-27 Profit Factor:0.00 Total Net Profit:0.00

BackTest : USDCAD on H1

From 2009-12-01 to 2010-01-01 Profit Factor:0.00 Total Net Profit:0.00

BackTest : USDCHF on H1

From 2009-12-01 to 2010-01-01 Profit Factor:0.00 Total Net Profit:0.00

BackTest : USDJPY on H1

From 2009-11-01 to 2009-11-30 Profit Factor:0.00 Total Net Profit:0.00

Request Backtest for VisualOpenOrderWithMM


From : (yyyy/mm/dd) To: (yyyy/mm/dd)

Pair: Period: