Hi!
I would Like to request an EA, that is basically an Breakout EA and First you Tell the EA an time of the Candle that it should Mark the highs and lows of, and then after that time, depending on which tf it IS, it buys If Candle closes above the Zone, but also has a Wick or the Body still in the Zone, and Same for selling, Just that the Candle should be under the Zone (and Body or Wick in it). Also IT would be cool, If there is a setting with min. ATR Level and which period. And maybe SMA Settings too (to Just buy above 200 SMA and sell under)
TP settings are also good, and SL should be dynamic (If sell, then sl = high of that Candle which Is used as Zone and If buy then sel = Low of canlce that is used as Zone)
It would be perfect If there is a setting to add Off Pips
Where you enter your Pips Size and TP gets reduced by These Pips and SL gets wider, so You dont get Wicked Out, or dont Take Profit.
I have tried this, maybe it can Help you
input double UpZone = 1.3000; // Define your UpZone value
input double DownZone = 1.2900; // Define your DownZone value
input int ATR_Period = 14; // ATR period
input double MinATRLevel = 0.001; // Minimum ATR level to trigger a trade
input double TakeProfitPips = 20; // Take Profit in pips
input double SpreadPips = 2; // Desired spread in pips
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
// Add initialization code here
if (!CheckSettings()) {
Print("EA initialization failed. Check settings.");
return(INIT_FAILED);
}
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
double closePrice = iClose(Symbol(), 0, 0);
double openPrice = iOpen(Symbol(), 0, 0);
double highPrice = iHigh(Symbol(), 0, 0);
double lowPrice = iLow(Symbol(), 0, 0);
double atrValue = iATR(Symbol(), 0, ATR_Period, 0);
double stopLoss, takeProfit; // Declare variables outside of if statements
// Check if ATR is greater than the specified minimum level
if (atrValue >= MinATRLevel)
{
// Check if candle closes below DownZone but also has its body in the Zone
if (closePrice < DownZone && openPrice > DownZone)
{
stopLoss = DownZone + SpreadPips * Point;
takeProfit = openPrice + TakeProfitPips * Point - SpreadPips * Point;
// Execute sell logic
if (ExecuteSell(stopLoss, takeProfit) < 0) {
Print("Sell order execution failed. Check logs.");
}
}
// Check if candle closes above UpZone but also has a wick or body in the Zone
if (closePrice > UpZone && (highPrice > UpZone || lowPrice > UpZone))
{
stopLoss = UpZone - SpreadPips * Point;
takeProfit = openPrice - TakeProfitPips * Point + SpreadPips * Point;
// Execute buy logic
if (ExecuteBuy(stopLoss, takeProfit) < 0) {
Print("Buy order execution failed. Check logs.");
}
}
}
}
//+------------------------------------------------------------------+
//| Check EA settings |
//+------------------------------------------------------------------+
bool CheckSettings()
{
// Add additional checks if needed
return (TakeProfitPips > 0 && SpreadPips >= 0);
}
//+------------------------------------------------------------------+
//| Execute Sell Order |
//+------------------------------------------------------------------+
int ExecuteSell(double stopLoss, double takeProfit)
{
int attempts = 0;
int result;
do
{
result = OrderSend(Symbol(), OP_SELL, 0.1, iClose(Symbol(), 0, 0), 3, stopLoss, takeProfit, "Sell order", 0, 0, Red, 0, 0, 0);
attempts++;
// Add a delay to allow the market to settle
Sleep(1000);
}
while (result < 0 && attempts < 3); // Maximum 3 attempts
return result;
}
//+------------------------------------------------------------------+
//| Execute Buy Order |
//+------------------------------------------------------------------+
int ExecuteBuy(double stopLoss, double takeProfit)
{
int attempts = 0;
int result;
do
{
result = OrderSend(Symbol(), OP_BUY, 0.1, iClose(Symbol(), 0, 0), 3, stopLoss, takeProfit, "Buy order", 0, 0, Blue, 0, 0, 0);
attempts++;
// Add a delay to allow the market to settle
Sleep(1000);
}
while (result < 0 && attempts < 3); // Maximum 3 attempts
return result;
}but UpZone and down Zone should be detected automatically by that one Candle which you should be able to declare in settings, for example
17:05
This will See the high and Low of that Candle and trade based of that (buy above and sell under, but Body or Wick should be includes in the Zone, and Just buy or sell at Close of Candle. Also adjust SL and TP by spread.
Thanks!
I would Like to request an EA, that is basically an Breakout EA and First you Tell the EA an time of the Candle that it should Mark the highs and lows of, and then after that time, depending on which tf it IS, it buys If Candle closes above the Zone, but also has a Wick or the Body still in the Zone, and Same for selling, Just that the Candle should be under the Zone (and Body or Wick in it). Also IT would be cool, If there is a setting with min. ATR Level and which period. And maybe SMA Settings too (to Just buy above 200 SMA and sell under)
TP settings are also good, and SL should be dynamic (If sell, then sl = high of that Candle which Is used as Zone and If buy then sel = Low of canlce that is used as Zone)
It would be perfect If there is a setting to add Off Pips
Where you enter your Pips Size and TP gets reduced by These Pips and SL gets wider, so You dont get Wicked Out, or dont Take Profit.
I have tried this, maybe it can Help you
input double UpZone = 1.3000; // Define your UpZone value
input double DownZone = 1.2900; // Define your DownZone value
input int ATR_Period = 14; // ATR period
input double MinATRLevel = 0.001; // Minimum ATR level to trigger a trade
input double TakeProfitPips = 20; // Take Profit in pips
input double SpreadPips = 2; // Desired spread in pips
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
// Add initialization code here
if (!CheckSettings()) {
Print("EA initialization failed. Check settings.");
return(INIT_FAILED);
}
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
double closePrice = iClose(Symbol(), 0, 0);
double openPrice = iOpen(Symbol(), 0, 0);
double highPrice = iHigh(Symbol(), 0, 0);
double lowPrice = iLow(Symbol(), 0, 0);
double atrValue = iATR(Symbol(), 0, ATR_Period, 0);
double stopLoss, takeProfit; // Declare variables outside of if statements
// Check if ATR is greater than the specified minimum level
if (atrValue >= MinATRLevel)
{
// Check if candle closes below DownZone but also has its body in the Zone
if (closePrice < DownZone && openPrice > DownZone)
{
stopLoss = DownZone + SpreadPips * Point;
takeProfit = openPrice + TakeProfitPips * Point - SpreadPips * Point;
// Execute sell logic
if (ExecuteSell(stopLoss, takeProfit) < 0) {
Print("Sell order execution failed. Check logs.");
}
}
// Check if candle closes above UpZone but also has a wick or body in the Zone
if (closePrice > UpZone && (highPrice > UpZone || lowPrice > UpZone))
{
stopLoss = UpZone - SpreadPips * Point;
takeProfit = openPrice - TakeProfitPips * Point + SpreadPips * Point;
// Execute buy logic
if (ExecuteBuy(stopLoss, takeProfit) < 0) {
Print("Buy order execution failed. Check logs.");
}
}
}
}
//+------------------------------------------------------------------+
//| Check EA settings |
//+------------------------------------------------------------------+
bool CheckSettings()
{
// Add additional checks if needed
return (TakeProfitPips > 0 && SpreadPips >= 0);
}
//+------------------------------------------------------------------+
//| Execute Sell Order |
//+------------------------------------------------------------------+
int ExecuteSell(double stopLoss, double takeProfit)
{
int attempts = 0;
int result;
do
{
result = OrderSend(Symbol(), OP_SELL, 0.1, iClose(Symbol(), 0, 0), 3, stopLoss, takeProfit, "Sell order", 0, 0, Red, 0, 0, 0);
attempts++;
// Add a delay to allow the market to settle
Sleep(1000);
}
while (result < 0 && attempts < 3); // Maximum 3 attempts
return result;
}
//+------------------------------------------------------------------+
//| Execute Buy Order |
//+------------------------------------------------------------------+
int ExecuteBuy(double stopLoss, double takeProfit)
{
int attempts = 0;
int result;
do
{
result = OrderSend(Symbol(), OP_BUY, 0.1, iClose(Symbol(), 0, 0), 3, stopLoss, takeProfit, "Buy order", 0, 0, Blue, 0, 0, 0);
attempts++;
// Add a delay to allow the market to settle
Sleep(1000);
}
while (result < 0 && attempts < 3); // Maximum 3 attempts
return result;
}but UpZone and down Zone should be detected automatically by that one Candle which you should be able to declare in settings, for example
17:05
This will See the high and Low of that Candle and trade based of that (buy above and sell under, but Body or Wick should be includes in the Zone, and Just buy or sell at Close of Candle. Also adjust SL and TP by spread.
Thanks!