• Home
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • User/Email: Password:
  • 3:39am
Menu
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • 3:39am
Sister Sites
  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Options

Bookmark Thread

First Page First Unread Last Page Last Post

Print Thread

Similar Threads

Very simple EA open trade at open of next candle 3 replies

Please help with an EA that can trade on H4 candle 12 replies

Buy on next Upward candle/Sell on next downward candle EA 2 replies

MT4 Script or EA to open trade on the next candle 14 replies

How to make EA that send Open Price of Candle for every new candle 5 replies

  • Platform Tech
  • /
  • Reply to Thread
  • Subscribe
Tags: EA to open trade on Next Candle open (help please)
Cancel

EA to open trade on Next Candle open (help please)

  • Post #1
  • Quote
  • First Post: Aug 22, 2007 5:02am Aug 22, 2007 5:02am
  •  alfianx
  • | Joined Apr 2007 | Status: Member | 12 Posts
hello,

is there anyone who can help me making a simple EA? the EA should open a market order on the next candle open. Also i gotta to be able to define (external variable..i think) whether it will be a 'buy' order or 'sell" order

please help
  • Post #2
  • Quote
  • Jul 19, 2013 4:24pm Jul 19, 2013 4:24pm
  •  palani
  • | Membership Revoked | Joined Nov 2012 | 15 Posts
I can give u the EA that opens opposte trade or same side trade. pl send email: [email protected]
 
 
  • Post #3
  • Quote
  • Jul 6, 2016 7:19am Jul 6, 2016 7:19am
  •  mahmood.tava
  • | Joined Jul 2016 | Status: Member | 54 Posts
here u r
pay attention in " if volume[0]<=1" this mean begining of candle

extern int Magic1=1;
extern int Magic2=2;
extern double lot=0.1;
extern int slippage=6;
extern int stoploss=40;
extern int takeprofit=50;
extern bool EnableAlert=true;
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----

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

//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
if(Volume[0]<=1)
{

if(Orders()==0)
{

if(CandleStatus()=="buy")
{
Pendbuy();
}

if(CandleStatus()=="sell")
{
Pendsell();
}

}

}
return(0);
}
//+------------------------------------------------------------------+
int Orders()
{
int num=0;
for(int i=OrdersTotal()-1;i>=0;i--)
{
OrderSelect(i,SELECT_BY_POS,MODE_TRADES);

if(OrderMagicNumber()==Magic1 || OrderMagicNumber()==Magic2)

num++;

}
return(num);
}
//--------------------------------------------------------------------
string CandleStatus()
{
if(Close[1]>=Open[1])
return("buy");
else
if(Close[1]<Open[1])
return("sell");
}
//---------------------------------------------------------------------
void Pendbuy()
{
int ticket=OrderSend(Symbol(),OP_BUY,lot,Ask,slippage,Ask-stoploss*MathPow(10,-Digits)
,Ask+takeprofit*MathPow(10,-Digits),"mt_buyyyyyyyy",Magic1,0,Blue);
if(EnableAlert==true)
{
if(ticket>0)
Alert("Buy Signal");
}
}
//---------------------------------------------------------------------
void Pendsell()
{
int ticket=OrderSend(Symbol(),OP_SELL,lot,Bid,slippage,Bid+stoploss*MathPow(10,-Digits)
,Bid-takeprofit*MathPow(10,-Digits),"mt_sellllllll",Magic2,0,Red);
if(EnableAlert==true)
{
if(ticket>0)
Alert("Sell Signal");
}
 
 
  • Post #4
  • Quote
  • Aug 20, 2016 3:34am Aug 20, 2016 3:34am
  •  goodways100
  • Joined Dec 2013 | Status: Member | 615 Posts
C
 
 
  • Post #5
  • Quote
  • Last Post: Aug 20, 2016 3:35am Aug 20, 2016 3:35am
  •  goodways100
  • Joined Dec 2013 | Status: Member | 615 Posts
Can you tell me how do you make ea of the above code. Thanks and
Regards
 
 
  • Platform Tech
  • /
  • EA to open trade on Next Candle open (help please)
  • Reply to Thread
0 traders viewing now
Top of Page
  • Facebook
  • Twitter
About FF
  • Mission
  • Products
  • User Guide
  • Media Kit
  • Blog
  • Contact
FF Products
  • Forums
  • Trades
  • Calendar
  • News
  • Market
  • Brokers
  • Trade Explorer
FF Website
  • Homepage
  • Search
  • Members
  • Report a Bug
Follow FF
  • Facebook
  • Twitter

FF Sister Sites:

  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Forex Factory® is a brand of Fair Economy, Inc.

Terms of Service / ©2023