Author: Dany Andr�s Benjumea G.
Orders Execution
Checks for the total of open ordersIt automatically opens orders when conditions are reachedIt can change open orders parameters, due to possible stepping strategy
1 Views
0 Downloads
0 Favorites

Profitability Reports

GBP/CAD Oct 2024 - Jan 2025
0.00 %
Total Trades 0
Won Trades 0
Lost trades 0
Win Rate 0.0 %
Expected payoff 0.00
Gross Profit 0.00
Gross Loss 0.00
Total Net Profit 0.00
-100%
-50%
0%
50%
100%
GBP/USD Oct 2024 - Jan 2025
0.00 %
Total Trades 0
Won Trades 0
Lost trades 0
Win Rate 0.0 %
Expected payoff 0.00
Gross Profit 0.00
Gross Loss 0.00
Total Net Profit 0.00
-100%
-50%
0%
50%
100%
DANCA NEWS
//+------------------------------------------------------------------+
//|                                                STRADDLE NEWS.mq4 |
//|                                          Dany Andrés Benjumea G. |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "Dany Andrés Benjumea G."

// EXPERT ADVISOR DESIGNED FOR PLATFORMS WITH 5 Digits

extern double     StopLoss          = 100;   // 10 pips
extern double     TakeProfit        = 300;   // 30 pips
extern double     TrailingStop      = 50;    //  5 pips
extern double     PipsAway          = 50;    //  Send pending orders 5 pips away from the current Bid & Ask
extern double     BalanceUsed       = 0.01;  //  Higher Balance Used --> Higher Risk
extern double     SpreadOperation   = 25;    //  Spread allowed 2,5 pips. If spread is higher than allowed, it doesn't send any pending order 
extern double     Slippage          = 30;    //  Slippage allowed 3,0 pips.
extern int        Leverage          = 400;   //  Broker leverage
double            Lots;                      //  Calculates the number of lots according to the balance used and leverage
int               ticket1, ticket2;
int               t = 0;

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
//----
int Spread = MarketInfo(Symbol(),MODE_SPREAD);

if(t < 1)
{
if(Spread < SpreadOperation && OrdersTotal() < 1)
   {
   Lots =(AccountBalance()*Leverage*BalanceUsed)/(100000*Ask);
   ticket1 = OrderSend(Symbol(),OP_BUYSTOP,Lots,Ask + PipsAway * Point, Slippage, Ask - StopLoss * Point,Ask + TakeProfit * Point,"DANCA",800424,0,White);  
   t=t+1;
   ticket2 = OrderSend(Symbol(),OP_SELLSTOP,Lots,Bid - PipsAway * Point, Slippage, Bid + StopLoss * Point,Bid - TakeProfit * Point,"DANCA",240480,0,White);    
   t=t+1;
   }
} 
   

for (int i = 0; i < OrdersTotal(); i++) 
   {
   OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
   
      if (OrderType() == OP_BUY) 
         {
         OrderDelete(ticket2);
         if(Bid-OrderOpenPrice()>Point*TrailingStop)
            {
            if(OrderStopLoss()<Bid-Point*TrailingStop)
               {
               OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*TrailingStop,OrderTakeProfit(),0,Green);
               return(0);
               }
            }
          }

          if (OrderType() == OP_SELL) 
            {
               OrderDelete(ticket1);
               if((OrderOpenPrice()-Ask)>(Point*TrailingStop))
               {
                  if(OrderStopLoss()>(Ask+Point*TrailingStop))
                  {
                     OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Point*TrailingStop,OrderTakeProfit(),0,Red);
                     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 ---