Author: FMW_1
Orders Execution
Checks for the total of open ordersIt can change open orders parameters, due to possible stepping strategyIt automatically opens orders when conditions are reached
Indicators Used
Moving average indicatorFractalsLarry William percent range indicator
1 Views
0 Downloads
0 Favorites

Profitability Reports

AUD/USD Oct 2024 - Jan 2025
10.00 %
Total Trades 34
Won Trades 0
Lost trades 0
Win Rate 0.00 %
Expected payoff -61.91
Gross Profit 238.68
Gross Loss -2343.62
Total Net Profit -2104.94
-100%
-50%
0%
50%
100%
GBP/USD Oct 2024 - Jan 2025
615.00 %
Total Trades 111
Won Trades 110
Lost trades 1
Win Rate 0.99 %
Expected payoff 3.11
Gross Profit 412.20
Gross Loss -66.99
Total Net Profit 345.21
-100%
-50%
0%
50%
100%
NZD/USD Oct 2024 - Jan 2025
7.00 %
Total Trades 22
Won Trades 21
Lost trades 1
Win Rate 0.95 %
Expected payoff -99.06
Gross Profit 166.68
Gross Loss -2346.00
Total Net Profit -2179.32
-100%
-50%
0%
50%
100%
FMW_1
//+------------------------------------------------------------------+
//|                                                        FMW_1.mq4 |
//|                                                                * |
//|                                                                * |
//+------------------------------------------------------------------+
#property copyright "FMW_1"
#property link "fraktalis@gmail.com"


//---- input parameters
extern   double  Lots=0.2;
extern   bool    RiskManagement=true;
extern   double  RiskPercent=20;
extern   int     StopLose=0;
extern   int     TakeProfit=12; 
extern   int     TrailingStop=0;
extern   int     WPRSell=10;
extern   int     WPRBuy=90;
extern   int     S=80; // EMA
extern   int     B=40; // EMA
int start()


  {
  
  double SL,TP;
  int Total=0;

  for(int cnt=0;cnt<OrdersTotal();cnt++)
   {
  OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES);
   if(OrderSymbol()==Symbol())
      {
      Total++;
      if(OrderType()==OP_BUY)
         {
         if(TrailingStop>0
         && Bid-OrderOpenPrice()>Point*TrailingStop
         && OrderStopLoss()<Bid-Point*TrailingStop)
            {
            OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*TrailingStop,OrderTakeProfit(),0);
            return(0);
            }
         }
      if(OrderType()==OP_SELL)
         {
         if(TrailingStop>0
         && OrderOpenPrice()-Ask>Point*TrailingStop
         && (OrderStopLoss()>Ask+Point*TrailingStop || OrderStopLoss()==0))
            {
            OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Point*TrailingStop,OrderTakeProfit(),0);
            return(0);
            }
         }
      }
   }
  
  if(OrdersTotal()==1)return(0);
  
    if(RiskManagement)
  {
      if(RiskPercent<0.1||RiskPercent>100)   
      {
      Comment("Invalid Risk Value.");
      return(0);
      }
      else
          {
          Lots=MathFloor((AccountFreeMargin()*AccountLeverage()*RiskPercent*Point*100)/(Ask*MarketInfo(Symbol(),MODE_LOTSIZE)*
                MarketInfo(Symbol(),MODE_MINLOT)))*MarketInfo(Symbol(),MODE_MINLOT);
          }
  }
  if(Lots<0.01)Lots=0.01;//My min lots
  if(Lots>100)Lots=100;//My max lots  
  if(RiskManagement==false){Lots=Lots;}
  
         double SellMA=iMA(NULL,0,S,0,MODE_EMA,PRICE_OPEN,1);
         double BuyMA=iMA(NULL,0,B,0,MODE_EMA,PRICE_OPEN,1);
         double hight=iFractals(NULL,0,MODE_UPPER,3);
         double low=iFractals(NULL,0,MODE_LOWER,3);
         double R=iWPR(NULL,0,21,1);
        
            if(SellMA>BuyMA && R>-WPRSell)

               {
               if (TakeProfit>0) TP=Bid-TakeProfit*Point;
               if (StopLose>0) SL=Bid+StopLose*Point;
               OrderSend(Symbol(),OP_SELL,Lots,Bid,2,SL,TP,NULL,0,0);
               return(0);
               }
          
            if(SellMA<BuyMA && R<-WPRBuy)

               {
               if (TakeProfit>0) TP=Ask+TakeProfit*Point;
               if (StopLose>0) SL=Ask-StopLose*Point;
               OrderSend(Symbol(),OP_BUY,Lots,Ask,2,SL,TP,NULL,0,0);
               return(0);
               }
               
  return(0);  
  }
//+------------------------------------------------------------------+

Comments

Markdown supported. Formatting help

Markdown Formatting Guide

Element Markdown Syntax
Heading # H1
## H2
### H3
Bold **bold text**
Italic *italicized text*
Link [title](https://www.example.com)
Image ![alt text](image.jpg)
Code `code`
Code Block ```
code block
```
Quote > blockquote
Unordered List - Item 1
- Item 2
Ordered List 1. First item
2. Second item
Horizontal Rule ---