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
0 Views
0 Downloads
0 Favorites

Profitability Reports

AUD/USD Oct 2024 - Jan 2025
107.00 %
Total Trades 60
Won Trades 0
Lost trades 0
Win Rate 0.00 %
Expected payoff 1.52
Gross Profit 1341.40
Gross Loss -1250.00
Total Net Profit 91.40
-100%
-50%
0%
50%
100%
GBP/USD Oct 2024 - Jan 2025
105.00 %
Total Trades 94
Won Trades 55
Lost trades 39
Win Rate 0.59 %
Expected payoff 1.12
Gross Profit 2055.40
Gross Loss -1950.00
Total Net Profit 105.40
-100%
-50%
0%
50%
100%
misterfx
#define MagicNumber 712008

extern int TakeProfit = 50;
extern int StopLoss = 50;
extern double Lots = 0.1;
extern int slippage = 3;
extern int TrailingStop = 30;
extern int TimeToTrade = 1;

double point = 0;
int day = -1;

int init()
{
   point = Point*MathPow(10,Digits%2);
   return(0);
}

void start()
{
   if( OrdersTotal() <= 0)
   {
      if (Hour() == TimeToTrade && Minute() == 0 && day != DayOfYear())
      {
         day = DayOfYear();
         OrderSend(Symbol(),OP_BUY,Lots,Ask,slippage,Ask-StopLoss*point,Ask+TakeProfit*point,"misterfx",MagicNumber,0,Lime);
         OrderSend(Symbol(),OP_SELL,Lots,Bid,slippage,Bid+StopLoss*point,Bid-TakeProfit*point,"misterfx",MagicNumber,0,Red);
      }
   } else {
      ManageTrades();
   }
   return(0);
}

void ManageTrades()
{
   for (int i = 0; i<OrdersTotal(); i++)
   {
      if (OrderSelect(i, SELECT_BY_POS,MODE_TRADES) == true)
      {
         if (OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber)
         {
            if (OrderType() == OP_BUY)
            {
               if (Bid-OrderOpenPrice() > TrailingStop * point)
               {
                  if (OrderStopLoss() < Bid-TrailingStop * point || OrderStopLoss() == 0)
                  {
                     ModifyStopLoss(Bid-TrailingStop * point);
                  }
               }
            }
            if (OrderType() == OP_SELL)
            {
               if (OrderOpenPrice()-Ask > TrailingStop * point)
               {
                  if (OrderStopLoss() < Ask+TrailingStop * point || OrderStopLoss() == 0)
                  {
                     ModifyStopLoss(Ask+TrailingStop * point);
                  }
               }
            }
         }
      }
   }
   return(0);
}

void ModifyStopLoss(double newStopLoss)
{
   OrderModify(OrderTicket(), OrderOpenPrice(), newStopLoss, OrderTakeProfit(), 0, CLR_NONE); 
   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 ---