Modify Code so that it Performs the Same as the Attached Indicator

MQL5 지표 전문가

작업 종료됨

실행 시간 1 일
고객의 피드백
Good developer, recommend to anyone
피고용인의 피드백
Great customer. Clear description of requirement specification, fast communication. Looking forward to working with you again. Thanks

명시

This is a very straight forward request.

What I need is for the Bollinger Bands Buy / Sell functions below to perform the same as the indicator that is attached.

Delivery will comprise of a video / demonstration that the functions will work within an expert advisor / work in a similar manner to the indicator.

I've shared the following below:

  • Photo of Indicator (ibbfill2)
  • Functions Bollinger Bands Buy / Sell (these functions should match the conditions of the ibbfill2 indicator (i.e. when the Indicator shades Blue - that is the same as Bollinger Bands Buy / vice versa for Bollinger Bands Sell)
  • iBandsMQL4 Function (because MT5 does not have shift / a proper way to indicate the MAIN / UPPER / LOWER Bound) I have created this function. Note if you have an alternative, feel free to replace this.


Photo of Indicator:

Indicator Example



Functions - Bollinger Bands Buy & Sell:

bool BollingerBandsBuy(string symb)
{
    bool state = false;

    double bid = SymbolInfoDouble(symb, SYMBOL_BID);
    double ask = SymbolInfoDouble(symb, SYMBOL_ASK);
    double close = iClose(symb, PERIOD_M5, 1);

    static bool conditionMet[12]; // Array to store conditionMet for each symbol
    string symbols_group[] = {symb1, symb2, symb3, symb4, symb5, symb6, symb7, symb9, symb10, symb11, symb12 };
    int numSymbols = ArraySize(symbols_group);

    if (ArraySize(conditionMet) != numSymbols)
    {
        ArrayResize(conditionMet, numSymbols);
    }

    int symbolIndex = -1;
    for (int i = 0; i < numSymbols; i++)
    {
        if (symb == symbols_group[i])
        {
            symbolIndex = i;
            break;
        }
    }

    if (symbolIndex == -1)
    {
        Print("Symbol not found in the group.");
        return false;
    }

    //------------------------------------------------------------------------

    double iBandsMain1 = iBandsMQL4(symb, PERIOD_M15, 20, 2, 0, 1);
    double iBandsUpper1 = iBandsMQL4(symb, PERIOD_M15, 20, 2, 1, 1);
    double iBandsLower1 = iBandsMQL4(symb, PERIOD_M15, 20, 2, 2, 1);

    //------------------------------------------------------------------------

    //---------------------- Buy Condition Initial Trigger -------------------

    if (close > iBandsUpper1)
    {
        conditionMet[symbolIndex] = true;
    }
    else if (close < iBandsMain1)
    {
        conditionMet[symbolIndex] = false;
    }

    //---------------------- Condition Start ---------------------------

    if (conditionMet[symbolIndex] && ask > iBandsMain1)
    {
        state = true;
    }

    return state;
}


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

bool BollingerBandsSell(string symb)
{
    bool state = false;

    double bid = SymbolInfoDouble(symb, SYMBOL_BID);
    double ask = SymbolInfoDouble(symb, SYMBOL_ASK);
    double close = iClose(symb, PERIOD_M5, 1);

    static bool conditionMet[12]; // Array to store conditionMet for each symbol
    string symbols_group[] = {symb1, symb2, symb3, symb4, symb5, symb6, symb7, symb9, symb10, symb11, symb12 };
    int numSymbols = ArraySize(symbols_group);

    if (ArraySize(conditionMet) != numSymbols)
    {
        ArrayResize(conditionMet, numSymbols);
    }

    int symbolIndex = -1;
    for (int i = 0; i < numSymbols; i++)
    {
        if (symb == symbols_group[i])
        {
            symbolIndex = i;
            break;
        }
    }

    if (symbolIndex == -1)
    {
        Print("Symbol not found in the group.");
        return false;
    }

    //------------------------------------------------------------------------

    double iBandsMain1 = iBandsMQL4(symb, PERIOD_M15, 20, 2, 0, 1);
    double iBandsUpper1 = iBandsMQL4(symb, PERIOD_M15, 20, 2, 1, 1);
    double iBandsLower1 = iBandsMQL4(symb, PERIOD_M15, 20, 2, 2, 1);

    //------------------------------------------------------------------------

    //---------------------- Buy Condition Initial Trigger -------------------

    if (close < iBandsLower1)
    {
        conditionMet[symbolIndex] = true;
    }
    else if (close > iBandsMain1)
    {
        conditionMet[symbolIndex] = false;
    }

    //---------------------- Condition Start ---------------------------

    if (conditionMet[symbolIndex] && close < iBandsMain1)
    {
        state = true;
    }

    return state;
}

  • Note: I have added a conditionMet function to this so that I can store the boolean for the first time it exceeds the Upper Bollinger Band. I need this to work with multicurrencies hence the array that contains 12 symbols.


iBands MQL4 Function:

double iBandsMQL4(string symb, ENUM_TIMEFRAMES tf, int period, double StdDeviation, int line, int shift) 
{
    ENUM_TIMEFRAMES timeframe3 = TFMigrate(tf);

    int handleBB = iBands(symb, timeframe3, period, 0, StdDeviation, PRICE_CLOSE);

    double bbUpper[], bbLower[], bbMiddle[];
    ArraySetAsSeries(bbUpper, true);
    ArraySetAsSeries(bbLower, true);
    ArraySetAsSeries(bbMiddle, true);

    CopyBuffer(handleBB, BASE_LINE, 1, shift + 1, bbMiddle);
    CopyBuffer(handleBB, UPPER_BAND, 1, shift + 1, bbUpper);
    CopyBuffer(handleBB, LOWER_BAND, 1, shift + 1, bbLower);

    double iBandsValue;

    if (line == 0)
    {
        iBandsValue = NormalizeDouble(bbMiddle[shift], SymbolInfoInteger(symb, SYMBOL_DIGITS));
    }
    else if (line == 1)
    {
        iBandsValue = NormalizeDouble(bbUpper[shift], SymbolInfoInteger(symb, SYMBOL_DIGITS));
    }
    else if (line == 2)
    {
        iBandsValue = NormalizeDouble(bbLower[shift], SymbolInfoInteger(symb, SYMBOL_DIGITS));
    }
    else
    {
        iBandsValue = 0.0; // Default value in case of invalid line parameter
    }
   
    return iBandsValue;
}



응답함

1
개발자 1
등급
(144)
프로젝트
170
23%
중재
7
29% / 43%
기한 초과
4
2%
로드됨
2
개발자 2
등급
(297)
프로젝트
441
64%
중재
5
40% / 0%
기한 초과
4
1%
로드됨
비슷한 주문
Description: I am seeking an experienced MQL5 developer to create a custom Expert Advisor (EA) for MetaTrader 5 based on a specific trend-following strategy. The strategy includes precise risk management, advanced trade management features, and additional risk management tools. The EA should be adaptable to any timeframe on which it is attached. Below are the detailed requirements and parameters for the EA: Strategy
I need an EA trading frequently (HFT or something like), and it sould have some features below: 1、Have a clear trading logic 2、Have a good backtest result 3、Have a demonstrated benefitable result in a live account trading 4、Can avoid the news time period or not sensitive to news
Tenho um EA mql4 que está com funcionalidades funcionando e outras com funcionalidades sem funcionar. Tenho um vídeo do EA funcionando como deve funcionar perfeitamente. O meu não consegue seguir o mesmo programa pois quando coloca os pontos de parada e retirada são bem diferentes. Não tenho pressa para tempo, só queria que conseguisse renovar o EA. O arquivo do grafico anexo é como ele se encontra agora. O certo é
New york session based strategy 9:30 open Price takes out buy side or sell side liquidity Usually using 15min high and lows 5m entry Price takes out that high/low and price must close strongly back into the zone Is price is above price we have a sell bias vis versa for buys Sl is at the high or low with option for “offset” for cushion Tp is usually the opposite High or low. Would like the option for set pips-points &
Hello, I am looking for a skilled developer to create an Expert Advisor (EA) for MT4. The EA should close an open trade automatically when a Golden or Death Cross occurs in the Alligator Indicator. Please let me know if you have experience with similar projects and how we can discuss the details further
Hello there! I have a ATAS bot that would be discussed properly with you once you bid to this project, But majorly what i need is either: An update to my bot that allows it to watch one chart and trade on another within ATAS. Or an add on of some kind that allows it to watch one ATAS chart and then communicate with a bot that can execute trades in MT4/5. Bid now for more proper details
I want have the possibility to increase lotsize not alone by Lot-multiplier rather I want add a fix-lot increase for excample for 0,05 lot. I want have this for buy / sell and hedge-buy and hedge sell
I need someone to build an EA for me based on Trend and Pivot levels from custom Pivot and Trend indicators. I will provide more information to the selected programmer
Hello there! I have a ATAS bot that would be discussed properly with you once you bid to this project, But majorly what i need is either: An update to my bot that allows it to watch one chart and trade on another within ATAS. Or an add on of some kind that allows it to watch one ATAS chart and then communicate with a bot that can execute trades in MT4/5. Bid now for more proper details
Utilizing the MQL5 MetaEditor Wizard, I created an Expert Advisor, having the following Signal indicators: I was able to optimize the EA and reached a backtest with the following specifications: I was able to reach a profit level of 30K, as indicated below. However, the Bot is not without faults and following the backtest, I started a forward test with real live data and the results were not so great. The EA took a

프로젝트 정보

예산
40+ USD
개발자에게
36 USD
기한
 1 일