You didn't post a topic yet. Let us show you how to make your first topic and upload your favorite forex robot. Guide me

Skip to forum content

Login with Facebook

Login with Username and Password!

     Username:       Password:  Login

Register  |  Forgot Password?

 

 

The latest topics with attached files (Forex robots, Forex Indicators, etc..)

Forums in this category with details of Replies, Views, last post

new member is here

by ShakEel Ashiq

TrillionPipsEA

by Lau Fran Albuquerque

Blessing 3

by saeeds92


[ Closed ]

Pages 1

You must login or register to post a reply

RSS

Posts: 3
Please rate this topic
Current rating: 0
Votes: 0

Embed topic to your site
(edited by raselpro 04-28-15 19:21:24)

AC+AO ea v1 (+source code)

Topic: AC+AO ea v1 (+source code)

//+------------------------------------------------------------------+
//| This MQL is generated by Expert Advisor Builder                  |
//|                [url]http://sufx.core.t3-ism.net/ExpertAdvisorBuilder/[/url] |
//|                                                                  |
//|  In no event will author be liable for any damages whatsoever.   |
//|                      Use at your own risk.                       |
//|  Changes by Barry Vincent                                        |
//|  8/14/08 AC+AO v1 Fix error in code and the stops and take profit|                                                                |
//|          optimized for the eurusd                                |                                         |
//|                                                                  |
//+------------------- DO NOT REMOVE THIS HEADER --------------------+

#define SIGNAL_NONE 0
#define SIGNAL_BUY   1
#define SIGNAL_SELL  2
#define SIGNAL_CLOSEBUY 3
#define SIGNAL_CLOSESELL 4

#property copyright "Expert Advisor Builder"
#property link      "[url]http://sufx.core.t3-ism.net/ExpertAdvisorBuilder/[/url]"

extern int MagicNumber = 0;
extern bool SignalMail = False;
extern bool EachTickMode = True;
extern double Lots = 1.0;
extern int Slippage = 3;
extern bool UseStopLoss = True;
extern int StopLoss = 25;
extern bool UseTakeProfit = True;
extern int TakeProfit = 118;
extern bool UseTrailingStop = True;
extern int TrailingStop = 55;

int BarCount;
int Current;
bool TickCheck = False;
//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init() {
   BarCount = Bars;

   if (EachTickMode) Current = 0; else Current = 1;

   return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit() {
   return(0);
}
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start() {
   int Order = SIGNAL_NONE;
   int Total, Ticket;
   double StopLossLevel, TakeProfitLevel;



   if (EachTickMode && Bars != BarCount) TickCheck = False;
   Total = OrdersTotal();
   Order = SIGNAL_NONE;

   //+------------------------------------------------------------------+
   //| Variable Begin                                                   |
   //+------------------------------------------------------------------+


double Buy1_1 = iAC(NULL, 0, Current + 0);
double Buy1_2 = iAC(NULL, 0, Current + 1);
double Buy2_1 = iAC(NULL, 0, Current + 1);
double Buy2_2 = iAC(NULL, 0, Current + 2);
double Buy3_1 = iAO(NULL, 0, Current + 0);
double Buy3_2 = iAO(NULL, 0, Current + 1);

double Sell1_1 = iAC(NULL, 0, Current + 0);
double Sell1_2 = iAC(NULL, 0, Current + 1);
double Sell2_1 = iAC(NULL, 0, Current + 1);
double Sell2_2 = iAC(NULL, 0, Current + 2);
double Sell3_1 = iAO(NULL, 0, Current + 0);
double Sell3_2 = iAO(NULL, 0, Current + 1);

double CloseBuy1_1 = iAC(NULL, 0, Current + 0);
double CloseBuy1_2 = iAC(NULL, 0, Current + 1);
double CloseBuy2_1 = iAC(NULL, 0, Current + 1);
double CloseBuy2_2 = iAC(NULL, 0, Current + 2);

double CloseSell1_1 = iAC(NULL, 0, Current + 0);
double CloseSell1_2 = iAC(NULL, 0, Current + 1);
double CloseSell2_1 = iAC(NULL, 0, Current + 1);
double CloseSell2_2 = iAC(NULL, 0, Current + 2);

   
   //+------------------------------------------------------------------+
   //| Variable End                                                     |
   //+------------------------------------------------------------------+

   //Check position
   bool IsTrade = False;

   for (int i = 0; i < Total; i ++) {
      OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
      if(OrderType() <= OP_SELL &&  OrderSymbol() == Symbol()) {
         IsTrade = True;
         if(OrderType() == OP_BUY) {
            //Close

            //+------------------------------------------------------------------+
            //| Signal Begin(Exit Buy)                                           |
            //+------------------------------------------------------------------+

                     if (CloseBuy1_1 < CloseBuy1_2 && CloseBuy2_1 > CloseBuy2_2) Order = SIGNAL_CLOSEBUY;


            //+------------------------------------------------------------------+
            //| Signal End(Exit Buy)                                             |
            //+------------------------------------------------------------------+

            if (Order == SIGNAL_CLOSEBUY && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount)))) {
               OrderClose(OrderTicket(), OrderLots(), Bid, Slippage, MediumSeaGreen);
               if (SignalMail) SendMail("[Signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Bid, Digits) + " Close Buy");
               if (!EachTickMode) BarCount = Bars;
               IsTrade = False;
               continue;
            }
            //Trailing stop
            if(UseTrailingStop && TrailingStop > 0) {                 
               if(Bid - OrderOpenPrice() > Point * TrailingStop) {
                  if(OrderStopLoss() < Bid - Point * TrailingStop) {
                     OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * TrailingStop, OrderTakeProfit(), 0, MediumSeaGreen);
                     if (!EachTickMode) BarCount = Bars;
                     continue;
                  }
               }
            }
         } else {
            //Close

            //+------------------------------------------------------------------+
            //| Signal Begin(Exit Sell)                                          |
            //+------------------------------------------------------------------+

                     if (CloseSell1_1 > CloseSell1_2 && CloseSell2_1 < CloseSell2_2) Order = SIGNAL_CLOSESELL;


            //+------------------------------------------------------------------+
            //| Signal End(Exit Sell)                                            |
            //+------------------------------------------------------------------+

            if (Order == SIGNAL_CLOSESELL && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount)))) {
               OrderClose(OrderTicket(), OrderLots(), Ask, Slippage, DarkOrange);
               if (SignalMail) SendMail("[Signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Ask, Digits) + " Close Sell");
               if (!EachTickMode) BarCount = Bars;
               IsTrade = False;
               continue;
            }
            //Trailing stop
            if(UseTrailingStop && TrailingStop > 0) {                 
               if((OrderOpenPrice() - Ask) > (Point * TrailingStop)) {
                  if((OrderStopLoss() > (Ask + Point * TrailingStop)) || (OrderStopLoss() == 0)) {
                     OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * TrailingStop, OrderTakeProfit(), 0, DarkOrange);
                     if (!EachTickMode) BarCount = Bars;
                     continue;
                  }
               }
            }
         }
      }
   }

   //+------------------------------------------------------------------+
   //| Signal Begin(Entry)                                              |
   //+------------------------------------------------------------------+

   if (Buy1_1 > Buy1_2 && Buy2_1 < Buy2_2 && Buy3_1 > Buy3_2) Order = SIGNAL_BUY;

   if (Sell1_1 < Sell1_2 && Sell2_1 > Sell2_2 && Sell3_1 < Sell3_2) Order = SIGNAL_SELL;


   //+------------------------------------------------------------------+
   //| Signal End                                                       |
   //+------------------------------------------------------------------+

   //Buy
   if (Order == SIGNAL_BUY && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount)))) {
      if(!IsTrade) {
         //Check free margin
         if (AccountFreeMargin() < (1000 * Lots)) {
            Print("We have no money. Free Margin = ", AccountFreeMargin());
            return(0);
         }

         if (UseStopLoss) StopLossLevel = Ask - StopLoss * Point; else StopLossLevel = 0.0;
         if (UseTakeProfit) TakeProfitLevel = Ask + TakeProfit * Point; else TakeProfitLevel = 0.0;

         Ticket = OrderSend(Symbol(), OP_BUY, Lots, Ask, Slippage, StopLossLevel, TakeProfitLevel, "Buy(#" + MagicNumber + ")", MagicNumber, 0, DodgerBlue);
         if(Ticket > 0) {
            if (OrderSelect(Ticket, SELECT_BY_TICKET, MODE_TRADES)) {
                Print("BUY order opened : ", OrderOpenPrice());
                if (SignalMail) SendMail("[Signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Ask, Digits) + " Open Buy");
            } else {
                Print("Error opening BUY order : ", GetLastError());
            }
         }
         if (EachTickMode) TickCheck = True;
         if (!EachTickMode) BarCount = Bars;
         return(0);
      }
   }

   //Sell
   if (Order == SIGNAL_SELL && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount)))) {
      if(!IsTrade) {
         //Check free margin
         if (AccountFreeMargin() < (1000 * Lots)) {
            Print("We have no money. Free Margin = ", AccountFreeMargin());
            return(0);
         }

         if (UseStopLoss) StopLossLevel = Bid + StopLoss * Point; else StopLossLevel = 0.0;
         if (UseTakeProfit) TakeProfitLevel = Bid - TakeProfit * Point; else TakeProfitLevel = 0.0;

         Ticket = OrderSend(Symbol(), OP_SELL, Lots, Bid, Slippage, StopLossLevel, TakeProfitLevel, "Sell(#" + MagicNumber + ")", MagicNumber, 0, DeepPink);
         if(Ticket > 0) {
            if (OrderSelect(Ticket, SELECT_BY_TICKET, MODE_TRADES)) {
                Print("SELL order opened : ", OrderOpenPrice());
                if (SignalMail) SendMail("[Signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Bid, Digits) + " Open Sell");
            } else {
                Print("Error opening SELL order : ", GetLastError());
            }
         }
         if (EachTickMode) TickCheck = True;
         if (!EachTickMode) BarCount = Bars;
         return(0);
      }
   }

   if (!EachTickMode) BarCount = Bars;

   return(0);
}
//+------------------------------------------------------------------+
Post's attachments

AC+AO ea v1.mq4 10.44 kb, 8 downloads since 2015-04-28 

Share

Re: AC+AO ea v1 (+source code)

thanks for sharing this information, i will have a try on it also

Share

Re: AC+AO ea v1 (+source code)

Hello.

I  try on it also



I made a backtest.

Then Demo.

It look good.

Thanks.
Manuel

Share

Posts: 3

Pages 1

You must login or register to post a reply

Last Posts

  • 19/06: Aggressor3_Great EA
  • 19/06: new member is here
  • 18/06: Does anyone have QT Indicator?
  • 18/06: Really Profitable EA 50-100% monthly
  • 17/06: cashflow - MQ4 file (expert advisor)
  • 16/06: My EA ichimoku
  • 16/06: EA LAU albuquerque - MQ4 file (expert advisor)
  • 16/06: TrillionPipsEA
  • 16/06: Assar Ultra©™ High Frequency Forex Scalping in 2018
  • 16/06: Non-Lag Inverse Fisher of RSX indicator
  • 16/06: Ubat 5.0
  • 16/06: Blessing 3
  • 15/06: Afraid of losing money
  • 15/06: Trading decision after analysis
  • 15/06: Hey guy free EA for your test
  • 15/06: Infinity Scalper indicator
  • 14/06: Assar V11
  • 14/06: 1200 EA file in on folder for free
  • 14/06: How to select god broker?
  • 13/06: Universal One Min Scalper - MQ4 file (expert advisor)
  • 13/06: success in the forex market
  • 13/06: Risk & Money Management.
  • 13/06: Forex Trader.
  • 12/06: XTX Expert 2.0 backtest results 2015-2018 starting @3k
  • 12/06: forex grinder EA
  • 12/06: ole$ya-PRO EA V.1
  • 12/06: MT4 Account Management Service-Minimum Balance: $100 usd
  • 11/06: Secure Trading Life.
  • 11/06: Forex broker is a big deal.
  • 11/06: Capitalism Market.
  • 10/06: Forex for the freelancers
  • 09/06: Freedom to work
  • 08/06: Forex Bolan Grinder indicator
  • 08/06: 10K $ to 750 Million $ in 10 Year 69% Win. Should I put this EA Live ?
  • 08/06: How to improve your trading skills?
  • Hot Topics

  • ASSAR v8 (1042)
  • Scalper_v5 (free) (720)
  • A highly profitable Ea (465)
  • FX Magic Robot - Verified Live Working 3/13/17 (458)
  • 2000 pips daily (451)
  • ASSAR V9 (Trend Breakout Edition) 2017 Expert Advisor (417)
  • spartan bolt V6 (414)
  • Assar_03_EA (391)
  • ASSARV11 [EXCLUSIVE] ACTIVE MEMBERS ONLY! (274)
  • Forex Earth Robot (249)
  • Trade-Arbitrage EA (248)
  • xmt scalper (227)
  • Forex Math EA free for Mt4 (180)
  • Super Signal Scalping Profit Statement (178)
  • Rabbit3 £100 start Zero to Hero Updated EA (167)
  • Fracture 7.4.0 (156)
  • high profit EA (151)
  • SCALPER PALING JOSS EA is a Holy Grail (150)
  • New to forex? (148)
  • Ilan Expert Advisor for Metatrader 4 (136)
  • EA SmartAssTrade. (133)
  • Monster Profit Forex Robot (123)
  • WayGrow EA 1.7 (111)
  • scalperstarkpro downoad free (price 90 dollars) (92)
  • FX Magic Robot (91)
  • IceFX TraderAgent Pro EA v2.5.1 (86)
  • Profitable GBPJPY EA (true results) (85)
  • Unbelievable EA (83)
  • Hedge Expert Advisor (63)
  • 100 pips profits trading (63)
  • Good EA 2017. Free !!! (63)
  • Magic Fx Formula indicator-V2 (61)
  • Best Indicator That No Repaint!!! (61)
  • hello (60)
  • BAR EA V5.1 (60)

  • NOTE: Hacked or other illegal versions of copyrighted forex robots are highly prohibited on MT4talk.com. If you upload any illegal version of any copyrighted forex robot, your forum account will be banned. No exceptions.

     

    Forum statistics

    • Total number of registered users: 19,554
    • Newest registered user: Daniel Sanjay
    • Total number of topics: 10,978
    • Total number of posts: 36,356

    Copyright MT4talk.com Forum Rules - Privacy Policy.