[ea]AO_MFI_Ron_01

Author: Ron T
Price Data Components
Orders Execution
Checks for the total of open ordersIt automatically opens orders when conditions are reached
Indicators Used
Bill Williams Awesome oscillatorMoney flow index
0 Views
0 Downloads
0 Favorites

Profitability Reports

AUD/USD Oct 2024 - Jan 2025
36.00 %
Total Trades 756
Won Trades 0
Lost trades 0
Win Rate 0.00 %
Expected payoff -11.92
Gross Profit 5040.00
Gross Loss -14055.00
Total Net Profit -9015.00
-100%
-50%
0%
50%
100%
GBP/CAD Oct 2024 - Jan 2025
3.00 %
Total Trades 245
Won Trades 0
Lost trades 0
Win Rate 0.00 %
Expected payoff -36.90
Gross Profit 319.09
Gross Loss -9359.49
Total Net Profit -9040.40
-100%
-50%
0%
50%
100%
GBP/USD Oct 2024 - Jan 2025
10.00 %
Total Trades 234
Won Trades 42
Lost trades 192
Win Rate 0.18 %
Expected payoff -38.54
Gross Profit 966.00
Gross Loss -9984.00
Total Net Profit -9018.00
-100%
-50%
0%
50%
100%
[ea]AO_MFI_Ron_01
/*-----------------------------+
|			       |
| Shared by www.Aptrafx.com    |
|			       |
+------------------------------*/

//+------------------------------------------------------------------+
//| MFI + AO                                                         |
//+------------------------------------------------------------------+
#property copyright "Ron T"
#property link      "http://www.lightpatch.com/forex"

// user input
extern double Lots=1.0;
extern int MFIPeriod=14;
extern int TakeProfit=60;
extern int StopLoss=15;

// These are externs just so they're easy to adjust
extern int AOBuyLevel=0;
extern int AOSellLevel=0;
extern int MFIBuyLevel=50;
extern int MFISellLevel=50;

//Bar movement
double newbar=0;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//|------------------------------------------------------------------|

int init()
  {
   return(0);
  }


//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
   return(0);
  }


//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+


int start()
  {

   double p=Point();
   int      cnt=0;

   bool      found=false;
   bool     rising=false;
   bool    falling=false;
   bool      cross=false;

   double barmove0, barmove1;
   double  i0, i1, i2, i3;

   // Error checking
   if(AccountFreeMargin()<(1000*Lots))        {Print("-----NO MONEY"); return(0);}
   if(Bars<100)                               {Print("-----NO BARS "); return(0);}

   // do nothing unless the bar moved
   if (newbar == Time[0])                     {                        return(0);}

   // bar moved, update time   
   newbar=Time[0];
   
   
   // One order per Symbol
   for(cnt=OrdersTotal();cnt>=0;cnt--)
     {
      OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
      if( OrderSymbol()==Symbol() )
        {
         return(0);
        }
     }

   // finally we can compute a few things
   i2=iAO(Symbol(),0,0);
   i3=iMFI(Symbol(),0,MFIPeriod,0);
      
   //Long AO above 0 and MFI above 60
   if (i2>AOBuyLevel && i3>=MFIBuyLevel)
     {
      OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Ask-(StopLoss*p),Ask+(TakeProfit*p),"ZMRLQVYX",11123,0,White);
     }
        
   //Short AO below 0 and MFI below 40
   if (i2<AOSellLevel && i3<=MFISellLevel)
     {
      OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Ask+(StopLoss*p),Ask-(TakeProfit*p),"ZMRLQVYX",11321,0,Red);
     }
        
   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 ---