FXAnt 1.3_usdcad_h1

Author: Copyright � 2006, Renato P. dos Santos
Orders Execution
Checks for the total of open ordersIt automatically opens orders when conditions are reached
Indicators Used
Stochastic oscillator
0 Views
0 Downloads
0 Favorites

Profitability Reports

AUD/USD Oct 2024 - Jan 2025
64.00 %
Total Trades 725
Won Trades 0
Lost trades 0
Win Rate 0.00 %
Expected payoff -13.31
Gross Profit 17136.00
Gross Loss -26788.00
Total Net Profit -9652.00
-100%
-50%
0%
50%
100%
GBP/USD Oct 2024 - Jan 2025
24.00 %
Total Trades 229
Won Trades 88
Lost trades 141
Win Rate 0.38 %
Expected payoff -40.46
Gross Profit 2904.00
Gross Loss -12170.00
Total Net Profit -9266.00
-100%
-50%
0%
50%
100%
NZD/USD Oct 2024 - Jan 2025
50.00 %
Total Trades 482
Won Trades 203
Lost trades 279
Win Rate 0.42 %
Expected payoff -20.39
Gross Profit 9947.00
Gross Loss -19773.00
Total Net Profit -9826.00
-100%
-50%
0%
50%
100%
FXAnt 1.3_usdcad_h1
//+------------------------------------------------------------------+
//|                                                        FXAnt.mq4 |
//|                           Copyright © 2006, Renato P. dos Santos |
//|                                            http://www.reniza.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, Renato P. dos Santos"
#property link      "http://www.reniza.com"

extern int MaxTrades=2;
extern double lots=1;
extern int stoploss=50,takeprofit=70;
extern bool UseHourTrade = False;
extern int  FromHourTrade = 8;
extern int  ToHourTrade = 18;
extern bool UseStoFilter=true;
extern int StoTF=240,K=5,D=3,SL=3,Confirm=1;

extern bool UseBothLinesMode=false;


int ID=983789;

void deinit() {
   Comment("");
}

int orderscnt(){
int cnt=0;
   for(int i =0;i<OrdersTotal();i++){
      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)){
         if(OrderSymbol()==Symbol() && ID==OrderMagicNumber()){
            cnt++;
         }
      }
   }
   return(cnt);
}

double sto(int type,int period){
   double 
   sto1 = iStochastic(NULL,StoTF,K,D,SL,MODE_SMA,0,MODE_MAIN,period),
   sto2 = iStochastic(NULL,StoTF,K,D,SL,MODE_SMA,0,MODE_SIGNAL,period);
   if(type==1)return(sto1);
   if(type==2)return(sto2);
}
   

int start()
  {
  if (UseHourTrade){
   if(!(Hour()>=FromHourTrade&&Hour()<=ToHourTrade)){
   Comment("Non-Trading Hours!");
   return(0);
   }
   }
  int x=Confirm;
  double sl,tp;
   
   
   if (Period() < 30) {Comment("change to M30 or higher pls"); return(0); }
   if (MathMod(Minute(),Period()) >= 0.5*Period()) return(0);

   if ((High[0]-Low[0])>10*Point && Open[0]<(High[0]+Low[0])/2 && Ask < Open[0]){
      if(orderscnt()<MaxTrades && (!UseStoFilter || sto(1,x)>sto(2,x)) && (!UseBothLinesMode || sto(1,x)>80 && sto(2,x)>80) ){
         if(stoploss==0){sl=0;}else{sl=Bid-stoploss*Point;}
         if(takeprofit==0){tp=0;}else{tp=Bid+takeprofit*Point;}
         OrderSend(Symbol(),OP_BUY,lots,Ask,2,sl,tp,"FXAnt",ID,0,Blue); 
      }
   }
   if ((High[0]-Low[0])>10*Point && Open[0]>(High[0]+Low[0])/2 && Bid > Open[0]){
      if(orderscnt()<MaxTrades && (!UseStoFilter || sto(1,x)<sto(2,x)) && (!UseBothLinesMode || sto(1,x)<20 && sto(2,x)<20) ){
         if(stoploss==0){sl=0;}else{sl=Ask+stoploss*Point;}
         if(takeprofit==0){tp=0;}else{tp=Ask-takeprofit*Point;}
         OrderSend(Symbol(),OP_SELL,lots,Bid,2,sl,tp,"FXAnt",ID,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 ---