I'm trying to write a simple EA for swing trading and waits for confirmation, but doesn't open the order
OrderSend(Symbol(), OP_BUY, Lot, NormalizeDouble(Ask, Digits), 3, 50, 15, comment,Magic_aldus, 0, Green);
OrderSend(Symbol(), OP_BUY, Lot, Ask, 3, Ask-50*Point, Ask+15*Point, comment,Magic_aldus, 0, Green);
& if MarketInfo(Symbol(),MODE_POINT) = 0.001 or 0.00001 :
OrderSend(Symbol(), OP_BUY, Lot, Ask, 3, Ask-500*Point, Ask+150*Point, comment,Magic_aldus, 0, Green);
ThanK you it works now
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi there,
would you help me to fix this EA, is a simple EA in which you enter 2 prices, into a uptrend waiting for the bounce, the first is the level touch and the second one above the confirmation level necessary to open an order, but unfortunatelly doesn't open any order ??
Thank you in advance
//+------------------------------------------------------------------+
//| aldus_UpTrend.mq4 |
//| By Aldus |
//| https://www.metaquotes.net// |
//+------------------------------------------------------------------+
#property copyright "By Aldus"
#property link "https://www.metaquotes.net//"
//+------------------------------------------------------------------+
//| script program start function |
//+------------------------------------------------------------------+
//--------------------------------------------------------------------
extern double Level_touch = 1.2500; // External variable
extern double Level_confirmation = 1.2200; // External variable
extern int n = 5; // External variable
extern double Lot= 0.07; // External variable
bool Fact_1 = false; // Global variable
bool Fact_2 = false; // Global variable
int Magic_aldus=99999; // Global variable
string comment= "ordine aperto"; // Global variable
//--------------------------------------------------------------------
int init()
{ Comment("test aldusUp");
return(0);
}
//--------------------------------------------------------------------
int start()
{
double Price = Bid; // Local variable
if (Fact_2==true) // If there was an Alert..
return(0); //..exit
if (NormalizeDouble(Price,Digits) <= NormalizeDouble(Level_touch,Digits))
{Fact_1 = true; // Event 1 happened
Comment("Level touched"); }
if (Fact_1 == true && NormalizeDouble(Price,Digits)>= NormalizeDouble(Level_confirmation,Digits))
My_Alert(); // User-defined function call open transaction
return(0); // Exit start()
}
//+------------------------------------------------------------------+
//--------------------------------------------------------------------
void My_Alert() // User-defined function
{
Comment("Confirmation occurred, an order should be opened"); // Alert
OrderSend(Symbol(), OP_BUY, Lot, NormalizeDouble(Ask, Digits), 3, 50, 15, comment,Magic_aldus, 0, Green);
Fact_2 = true; // Event 2 happened
return(0); // Exit user-defined function
}
//--------------------------------------------------------------------
int deinit()
{
//GlobalVariableDel(Fact_1);
//GlobalVariableDel(Fact_2);
//GlobalVariableDel(Magic_aldus);
//GlobalVariableDel(comment);
return(0);
}