I need help editing an existing code. I would like my order to go off at a fixed price. example if GBPUSD hits 1.35420 my order opens.

Техническое задание

the sl doesnt work  i want the tp logic to remain

i need the trend direction fucntion tow ork i the trend is up then only buys if down only sells

i need the fibo nacci fucntion to work as well

and the flat zone function to work as well


and i need the code to trade 1% of the balance 


//+------------------------------------------------------------------+

//|                                                   US500_EA.mq4   |

//|                                  Copyright 2024, MetaQuotes Ltd. |

//|                                             https://www.mql5.com |

//+------------------------------------------------------------------+

#property copyright "Copyright 2024, MetaQuotes Ltd."

#property link      "https://www.mql5.com"

#property version   "1.07"

#property strict


// Input parameters

extern int SMA14_Period = 14;

extern int SMA50_Period = 50;

extern int SMA100_Period = 100;

extern int DistinctTrend_Period = 10; // Period for detecting distinct trend

extern int FlatRange_Period = 5;      // Period for detecting flat range

extern int MagicNumber = 12345;


// Global variables for trading

double sma14, sma50, sma100;

double upper15Percent, lower15Percent;


// Constants for US500 on IC Markets

const string SYMBOL = "US500";

const double LOT_SIZE = 1.0;

const double POINT_VALUE = 0.1; // Adjust this based on IC Markets' US500 contract specifications

const double STOP_LOSS_POINTS = 1.75; // Stop loss in points

const double TAKE_PROFIT_POINTS = 1.5; // Take profit in points


// Line names for chart objects

const string SMA14_LINE = "SMA14_Line";

const string SMA50_LINE = "SMA50_Line";

const string SMA100_LINE = "SMA100_Line";


//+------------------------------------------------------------------+

//| Expert initialization function                                   |

//+------------------------------------------------------------------+

int OnInit()

{

    // Check if the current symbol is US500

    if (Symbol() != SYMBOL)

    {

        Print("This EA is designed to work only with ", SYMBOL);

        return INIT_FAILED;

    }


    return(INIT_SUCCEEDED);

}


//+------------------------------------------------------------------+

//| Expert deinitialization function                                 |

//+------------------------------------------------------------------+

void OnDeinit(const int reason)

{

    // Remove all chart objects created by this EA

    ObjectsDeleteAll(0, OBJ_TREND);

}


//+------------------------------------------------------------------+

//| Expert tick function                                             |

//+------------------------------------------------------------------+

void OnTick()

{

    // Calculate and draw SMAs

    CalculateAndDrawIndicators();


    // Check if there's already an open trade

    if (IsTradeOpen())

    {

        return; // Exit the function as we don't want to open new trades

    }


    // Determine market conditions

    double highestHigh = High[iHighest(NULL, 0, MODE_HIGH, 100, 0)];

    double lowestLow = Low[iLowest(NULL, 0, MODE_LOW, 100, 0)];

    double range = highestHigh - lowestLow;

    upper15Percent = highestHigh - 0.15 * range;

    lower15Percent = lowestLow + 0.15 * range;


    bool distinctUptrend = IsDistinctTrend(1);

    bool distinctDowntrend = IsDistinctTrend(-1);

    bool inFibZone = (Bid >= upper15Percent || Bid <= lower15Percent);

    double currentSpread = MarketInfo(Symbol(), MODE_SPREAD) * POINT_VALUE;


    // Trading logic

    if (sma14 > sma50 && distinctUptrend && !inFibZone && !IsFlatRange())

    {

        OpenOrder(OP_BUY, currentSpread);

    }

    else if (sma14 < sma50 && distinctDowntrend && !inFibZone && !IsFlatRange())

    {

        OpenOrder(OP_SELL, currentSpread);

    }

}


//+------------------------------------------------------------------+

//| Calculate and draw SMAs                                          |

//+------------------------------------------------------------------+

void CalculateAndDrawIndicators()

{

    int draw_begin = Bars - 1000; // Draw for the last 1000 bars

    

    // Calculate current SMA values

    sma14 = iMA(NULL, 0, SMA14_Period, 0, MODE_SMA, PRICE_CLOSE, 0);

    sma50 = iMA(NULL, 0, SMA50_Period, 0, MODE_SMA, PRICE_CLOSE, 0);

    sma100 = iMA(NULL, 0, SMA100_Period, 0, MODE_SMA, PRICE_CLOSE, 0);

    

    DrawSMA(SMA14_LINE, SMA14_Period, draw_begin, Blue);

    DrawSMA(SMA50_LINE, SMA50_Period, draw_begin, Red);

    DrawSMA(SMA100_LINE, SMA100_Period, draw_begin, Green);

}


//+------------------------------------------------------------------+

//| Draw an SMA line on the chart                                    |

//+------------------------------------------------------------------+

void DrawSMA(const string name, const int period, const int draw_begin, const color line_color)

{

    ObjectDelete(name);

    ObjectCreate(name, OBJ_TREND, 0, Time[draw_begin], iMA(NULL, 0, period, 0, MODE_SMA, PRICE_CLOSE, draw_begin), 

                 Time[0], iMA(NULL, 0, period, 0, MODE_SMA, PRICE_CLOSE, 0));

    ObjectSetInteger(0, name, OBJPROP_COLOR, line_color);

    ObjectSetInteger(0, name, OBJPROP_WIDTH, 1);

    ObjectSetInteger(0, name, OBJPROP_RAY_RIGHT, true);

}


//+------------------------------------------------------------------+

//| Check if the market is in a distinct trend                       |

//+------------------------------------------------------------------+

bool IsDistinctTrend(int direction)

{

    for (int i = 1; i <= DistinctTrend_Period; i++)

    {

        double previousSMA100 = iMA(NULL, 0, SMA100_Period, 0, MODE_SMA, PRICE_CLOSE, i);

        if (direction * (sma100 - previousSMA100) <= 0)

            return false;

    }

    return true;

}


//+------------------------------------------------------------------+

//| Check if the market is in a flat range                           |

//+------------------------------------------------------------------+

bool IsFlatRange()

{

    double previousSMA100 = iMA(NULL, 0, SMA100_Period, 0, MODE_SMA, PRICE_CLOSE, 1);

    double previousSMA50 = iMA(NULL, 0, SMA50_Period, 0, MODE_SMA, PRICE_CLOSE, 1);

    

    return (MathAbs(sma100 - sma50) < FlatRange_Period * POINT_VALUE &&

            MathAbs(sma100 - previousSMA100) < 0.001 &&

            MathAbs(sma50 - previousSMA50) < 0.001);

}


//+------------------------------------------------------------------+

//| Open an order                                                    |

//+------------------------------------------------------------------+

void OpenOrder(int orderType, double spread)

{

    // First, check if there's already an open trade

    if (IsTradeOpen())

    {

        Print("A trade is already open. Skipping new order.");

        return;

    }


    double price = (orderType == OP_BUY) ? Ask : Bid;

    

    // Calculate stop loss: 1.75 points plus spread

    double stopLossDistance = STOP_LOSS_POINTS * POINT_VALUE + spread;

    double stopLoss = (orderType == OP_BUY) ? NormalizeDouble(price - stopLossDistance, Digits)

                                            : NormalizeDouble(price + stopLossDistance, Digits);

    

    // Calculate take profit: 1.5 points net

    double takeProfitDistance = TAKE_PROFIT_POINTS * POINT_VALUE + spread; // Adding spread to make it net

    double takeProfit = (orderType == OP_BUY) ? NormalizeDouble(price + takeProfitDistance, Digits)

                                              : NormalizeDouble(price - takeProfitDistance, Digits);


    int ticket = OrderSend(SYMBOL, orderType, LOT_SIZE, price, 3, stopLoss, takeProfit, "US500 Order", MagicNumber, 0, clrGreen);

    if (ticket < 0) 

    {

        Print("OrderSend failed with error #", GetLastError());

    }

    else

    {

        Print("Order opened successfully. Ticket: ", ticket, ", Stop Loss: ", stopLoss, ", Take Profit: ", takeProfit);

    }

}


//+------------------------------------------------------------------+

//| Check if there's an open trade                                   |

//+------------------------------------------------------------------+

bool IsTradeOpen()

{

    for (int i = 0; i < OrdersTotal(); i++)

    {

        if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))

        {

            if (OrderSymbol() == SYMBOL && OrderMagicNumber() == MagicNumber)

            {

                return true;

            }

        }

    }

    return false;

}

Откликнулись

1
Разработчик 1
Оценка
(1)
Проекты
4
0%
Арбитраж
1
0% / 0%
Просрочено
1
25%
Работает
2
Разработчик 2
Оценка
(6)
Проекты
11
9%
Арбитраж
0
Просрочено
2
18%
Занят
3
Разработчик 3
Оценка
(2)
Проекты
1
100%
Арбитраж
1
0% / 100%
Просрочено
0
Работает
4
Разработчик 4
Оценка
(1)
Проекты
1
0%
Арбитраж
0
Просрочено
0
Работает
5
Разработчик 5
Оценка
Проекты
0
0%
Арбитраж
0
Просрочено
0
Свободен
Похожие заказы
The BOT will send information about the trading account to Google Sheets - Information to send: Date, Currency Symbols, Spreads, Leverage, Swap in Points, Swap in Dollar Arrange them by Day and Month and put into appropirate tabs
Busco idea, ea grid 30 - 50 USD
Hola BUSCO IDEA tengo un robot que funciona de maravilla en tendencia, pero cuando el mercado se lateraliza se pone enrango en dos ZONAS se pierde mucho dinero. Busco la manera para que el robot NO OPERE EN ESOS MOMENTOS, que espere el momento del break out y empiese a ejecutar operaciones. A base de la idea se puede crear la version v2.0 del mi robot
My requirements are the following. I am ordering, I need an expert consultant on EA matters and an indicator in the trade pairs of XAUUSD and XAGUSD, we also need powerful robots for changing prices in the market. the market conditions, i.e. flexibility, then the business should be beneficial for all
Hello programmers, I’m looking only for veteran programmers with profound knowledge and experience in strategy optimization to improve my EA. The backtests are incredible, even with REAL TICKS of 100% quality Dukascopy data, but real results are quite disappointing on my specific brokerage. I would really love to adapt the EA so that back testing results and forward testing can better match. The strategy uses a
EA for prop firm 30 - 1500 USD
Hello, looking for a profitable ready made EA to use for funded account. Looking for an already made solution with source code, I can sign a NDA if needed. $1500 is my max amount. Please only send me a message if you got a version that you can share (locked on my account or time limited). Thanks
I will pay 500 to 5000 USD per strategy for both files (mq4 and mq5). Must be both file types for same strategy. mq5 file must have the ability to run a multi-currency backtest. EA/strategy must be, have or able to: 1. Profitable and stable income for all major currencies 2. Not more than 30:1 leveraged 3. Maximal DD 5% 4. Minimal monthly profit 5% 5. Low frequency trading 6. Lot-size derived
AE on StochRsi 35+ USD
AE on StochRsi . Creating an ea based om high and low RsiStoch on any timeframe. Because i need more than 30 words i keep on writing untill i have more than 30 words. And because of that i write the words above
Prop Firm EA 30+ USD
Who has or can develop a winning Prop Firm EA that can trade with less than 5% drawdown and achieve 10% profit in one month or 2 months at most
hello developers ! I need a professional developer already having experience in developing the indicators based on supply and demand zones. If you are experienced developer but have no expertise in Supply and Demand strategy please donot Bid. I am listing the most important Requirement here but there will be more requirements once we proceed. 1- The accurate Detection of supply and demand zones ( RBD,DBD,DBR,RBR). 2-
Hello devs, Looking to purchase EAs that are ready made, have proven track record (live account). DD should be minimal, no risky strategies. I can buy from multiple sellers, pricing will depend on EA results, functions and features if you are proud of your work, kindly send over investor credentials to start the discussion .... please, no backtest bullshit

Информация о проекте

Бюджет
40+ USD
Исполнителю
36 USD
Сроки выполнения
до 1 дн.