InterestPay v1.2

Author: Copyright � 2006, Ross Todd
Price Data Components
Series array that contains open time of each bar
Orders Execution
Checks for the total of open ordersIt Closes Orders by itself It automatically opens orders when conditions are reached
0 Views
0 Downloads
0 Favorites

Profitability Reports

AUD/USD Oct 2024 - Jan 2025
37.00 %
Total Trades 134
Won Trades 0
Lost trades 0
Win Rate 0.00 %
Expected payoff -15.55
Gross Profit 1238.00
Gross Loss -3322.00
Total Net Profit -2084.00
-100%
-50%
0%
50%
100%
GBP/USD Oct 2024 - Jan 2025
25.00 %
Total Trades 134
Won Trades 41
Lost trades 93
Win Rate 0.31 %
Expected payoff -39.01
Gross Profit 1779.00
Gross Loss -7007.00
Total Net Profit -5228.00
-100%
-50%
0%
50%
100%
NZD/USD Oct 2024 - Jan 2025
29.00 %
Total Trades 134
Won Trades 43
Lost trades 91
Win Rate 0.32 %
Expected payoff -18.78
Gross Profit 1041.00
Gross Loss -3557.00
Total Net Profit -2516.00
-100%
-50%
0%
50%
100%
InterestPay v1.2
/*-----------------------------+
|			       |
| Shared by www.Aptrafx.com    |
|			       |
+------------------------------*/

//+------------------------------------------------------------------+
//|                                            InterestPay v1.2.mq4 |
//|                                      Copyright © 2006,  Ross Tod |
//|                                               rosstodd@yahoo.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006,  Ross Todd"
#property link      "rosstodd@yahoo.com"
extern double Lots       = 1;
extern int CloseShortHr  = 20;
extern int CloseShortMin = 58;
extern int CloseLongHr   = 21;
extern int CloseLongMin  = 2;
extern int OpenHr        = 20;
extern int OpenMin       = 30;
extern int MagicNumber   = 20061002;

bool ShortSent=False;
bool LongSent=False;
bool ContinueOpening=False;
int Slippage = 5;

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
//----
   int cnt=0;
   int OpenOrders=0;
   bool res=False;
   
   for(cnt=0;cnt<OrdersTotal();cnt++)
   {
     if (OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES))
     {
      if ((OrderSymbol()==Symbol() && OrderMagicNumber()==MagicNumber))
      {
       OpenOrders++;
      }
     }
   }
   
   if (TimeHour(CurTime())==CloseShortHr
       && TimeMinute(CurTime())>=CloseShortMin)
   {
    for(cnt=0;cnt<OrdersTotal();cnt++)
    {
     if (OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES))
     {
      if (OrderSymbol()==Symbol() && OrderMagicNumber()==MagicNumber && OrderType()==OP_SELL)
       res=OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),Slippage,Red);
     }
    }
   }
   
   if (TimeHour(CurTime())==CloseLongHr
       && TimeMinute(CurTime())>=CloseLongMin)
   {
    for(cnt=0;cnt<OrdersTotal();cnt++)
    {
     if (OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES))
     {
      if (OrderSymbol()==Symbol() && OrderMagicNumber()==MagicNumber && OrderType()==OP_BUY)
       res=OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),Slippage,Blue);
     }
    }
   }
   
   if (TimeHour(CurTime())==OpenHr
       && TimeMinute(CurTime())==OpenMin && OpenOrders<1)
   {
    ContinueOpening=True;
    LongSent=False;
    ShortSent=False;
   }

   if (!ShortSent && ContinueOpening)
   {
    res=OrderSend(Symbol(),OP_SELL,Lots,Bid,Slippage,0,0,"InterestPay"+MagicNumber,MagicNumber,0,Red);
    if (res)
     ShortSent=True;     
    else
     Print("Short Send Order error: ", GetLastError());
   }    

   if (!LongSent && ContinueOpening)
   {
    res=OrderSend(Symbol(),OP_BUY,Lots,Ask,Slippage,0,0,"SeparationTrade"+MagicNumber,MagicNumber,0,Blue);
    if (res)
     LongSent=True;
    else
     Print("Long Send Order error: ", GetLastError());
   }  
      
   
   if (ShortSent && LongSent)
    ContinueOpening=False;
//----
   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 ---