Author: Copyright � 2008, Silas Palmer.
Profit factor:
0.43
Orders Execution
It automatically opens orders when conditions are reached
0 Views
0 Downloads
0 Favorites
buy_v1
//+------------------------------------------------------------------+
//|                                                          buy.mq4 |
//|                      Copyright © 2008, Silas Palmer.             |
//|                                      http://www.silaspalmer.com/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2008, Silas Palmer."
#property link      "http://www.silaspalmer.com"
#include <stderror.mqh>
#include <stdlib.mqh>

// #property show_confirm
// Uncomment to enable confirmation

//+------------------------------------------------------------------+
//| script "buy at market, using money management as defined below"  |
//+------------------------------------------------------------------+
int start()
  {
   // Change these amounts to suit your needs
   
   int lotbucks = 50000; // 1 lot for every x dollars in your account. 
   int Slippage = 3; // Standard amount
   
   // Note script auto-detects minimum lot size
   // It also automatically scales lots based on currency pair 
   // (so that a 1 pip move will be $1 per lotbuck regardless of the pair chosen)
   
//----
   int cmd = -1; // Nothing (buy=0 sell=1)
   int i;
   double lots,minl,maxl,pipbucks,step; 
   
   // Calculate lots
   pipbucks = MarketInfo(Symbol(),MODE_TICKVALUE);
   minl = MarketInfo(Symbol(),MODE_MINLOT);
   maxl = MarketInfo(Symbol(),MODE_MAXLOT);
   step = MarketInfo(Symbol(),MODE_LOTSTEP);
   // Scale lots so 1 pip = $1 at 1 lot

   lots = MathFloor( (((10 / pipbucks) * AccountFreeMargin()) / lotbucks) / step) * step;
   if (lots < minl) lots = minl;
   if (lots > maxl) lots = maxl;    

   if ( OrderSend( Symbol(), OP_BUY, lots, Ask, Slippage, 0, 0, "Opened Buy Order", 0, 0, Orange ) > 0 )
         Print ( "Opened Buy Order at ", Ask );
      else 
         Alert ( "Could not open Buy order for ", Symbol(), " ", lots, " at ", Ask, " Error=", ErrorDescription(GetLastError()) );
  
  
//----
   return(0);
  }
//+------------------------------------------------------------------+

Profitability Reports

USD/CAD Oct 2024 - Jan 2025
0.90
Total Trades 81
Won Trades 30
Lost trades 51
Win Rate 37.04 %
Expected payoff -0.54
Gross Profit 388.48
Gross Loss -431.88
Total Net Profit -43.40
-100%
-50%
0%
50%
100%
NZD/USD Oct 2024 - Jan 2025
0.00
Total Trades 99
Won Trades 0
Lost trades 99
Win Rate 0.00 %
Expected payoff -13.06
Gross Profit 0.00
Gross Loss -1293.13
Total Net Profit -1293.13
-100%
-50%
0%
50%
100%
GBP/USD Oct 2024 - Jan 2025
0.38
Total Trades 49
Won Trades 0
Lost trades 0
Win Rate 0.00 %
Expected payoff -5.57
Gross Profit 167.52
Gross Loss -440.42
Total Net Profit -272.90
-100%
-50%
0%
50%
100%

Comments