Orders Execution
Checks for the total of open ordersIt automatically opens orders when conditions are reached
Indicators Used
Commodity channel indexBill Williams Accelerator/Decelerator oscillatorBill Williams Awesome oscillatorMACD Histogram
0 Views
0 Downloads
0 Favorites

Profitability Reports

AUD/USD Oct 2024 - Jan 2025
91.00 %
Total Trades 9
Won Trades 0
Lost trades 0
Win Rate 0.00 %
Expected payoff -288.67
Gross Profit 25068.00
Gross Loss -27666.00
Total Net Profit -2598.00
-100%
-50%
0%
50%
100%
GBP/USD Oct 2024 - Jan 2025
91.00 %
Total Trades 15
Won Trades 7
Lost trades 8
Win Rate 0.47 %
Expected payoff -291.73
Gross Profit 43528.00
Gross Loss -47904.00
Total Net Profit -4376.00
-100%
-50%
0%
50%
100%
ssb_583
//+-------------------------------------------------------------------------+
//|                                                                 SSB.mq4 |
//|                Copyright © 2009, Yury V. Reshetov  http://ssb.bigfx.ru/ |
//|                                                    http://ssb.bigfx.ru/ |
//+-------------------------------------------------------------------------+
#property copyright "Copyright © 2009, Yury V. Reshetov http://ssb.bigfx.ru"
#property link      "http://ssb.bigfx.ru"
extern double lots = 1;
extern int pcci = 9;
extern int fastmacd = 41;
extern int slowmacd = 58;
extern int signalmacd = 55;
extern int magic = 888;
extern int slippage = 0;
static int prevtime = 0;

int init() {
   prevtime = Time[0];
   return(0);
}

int start() {

   if (! IsTradeAllowed()) {
      return(0);
   }

   if (Time[0] == prevtime) {
      return(0);
   }
   prevtime = Time[0];

   int ticket = -1;
   int total = OrdersTotal();
   for (int i = total - 1; i >= 0; i--) {
      OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
      if ((OrderSymbol() == Symbol()) && (OrderMagicNumber() == magic)) {
         int prevticket = OrderTicket();
         if (OrderType() == OP_BUY) {
            if (shortsignal()) {
               ticket = OrderSend(Symbol(), OP_SELL, 2.0 * lots, Bid, slippage, 0, 0, WindowExpertName(), magic, 0, Red);
               Sleep(30000);
               if (ticket < 0) {
                  prevtime = Time[1];
                  return(0);
               } else {
                  OrderCloseBy(ticket, prevticket, Red);
               }
            }
          } else {
            if (longsignal()) {
               ticket = OrderSend(Symbol(), OP_BUY, 2.0 * lots, Ask, slippage, 0, 0, WindowExpertName(), magic, 0, Blue);
               Sleep(30000);
               if (ticket < 0) {
                  prevtime = Time[1];
                  return(0);
               } else {
                  OrderCloseBy(ticket, prevticket, Blue);
               }
            }
          }
          return(0);
      }
   }

   if (longsignal()) {
      ticket = OrderSend(Symbol(), OP_BUY, lots, Ask, slippage, 0, 0, WindowExpertName(), magic, 0, Blue);
      Sleep(30000);
      if (ticket < 0) {
         prevtime = Time[1];
      }
      return(0);
   }
   if (shortsignal()) {
      ticket = OrderSend(Symbol(), OP_SELL, lots, Bid, slippage, 0, 0, WindowExpertName(), magic, 0, Red);
      Sleep(30000);
      if (ticket < 0) {
         prevtime = Time[1];
      }
      return(0);
   }
   return(0);
}

bool longsignal() {
   if (fcci() < 0) {
      return(false);
   }
   if (fac() < 0) {
      return(false);
   }
   if (fao() < 0) {
      return(false);
   }
   if (fao1() < 0) {
      return(false);
   }
   if (fmacd1() < 0) {
      return(false);
   }
   return(true);
}

bool shortsignal() {
   if (fcci() > 0) {
      return(false);
   }
   if (fac() > 0) {
      return(false);
   }
   if (fao() > 0) {
      return(false);
   }
   if (fao1() > 0) {
      return(false);
   }
   if (fmacd1() > 0) {
      return(false);
   }
   return(true);
}

int fcci() {
   int result = 0;
   double ind = iCCI(Symbol(), 0, pcci, PRICE_OPEN, 0);
   if (ind < 0) {
      result = 1;
   }
   if (ind > 0) {
      result = -1;
   }
   return(result);
}

int fac() {
   int result = 0;
   double ind = iAC(Symbol(), 0, 0);
   if (ind > 0) {
      result = 1;
   }
   if (ind < 0) {
      result = -1;
   }
   return(result);
}

int fao() {
   int result = 0;
   double ind = iAO(Symbol(), 0, 0);
   if (ind > 0) {
      result = 1;
   }
   if (ind < 0) {
      result = -1;
   }
   return(result);
}

int fao1() {
   int result = 0;
   double ind = iAO(Symbol(), 0, 0);
   double ind1 = iAO(Symbol(), 0, 1);
   if ((ind - ind1) < 0) {
      result = 1;
   }
   if ((ind - ind1) > 0) {
      result = -1;
   }
   return(result);
}

int fmacd1() {
   int result = 0;
   double ind = iMACD(Symbol(), 0, fastmacd, slowmacd, signalmacd, PRICE_OPEN, MODE_MAIN, 0);
   double ind1 = iMACD(Symbol(), 0, fastmacd, slowmacd, signalmacd, PRICE_OPEN, MODE_MAIN, 1);
   if ((ind - ind1) > 0) {
      result = 1;
   }
   if ((ind - ind1) < 0) {
      result = -1;
   }
   return(result);
}

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 ---