1. Welcome back! Thank you for being a part of this Traders Community. Let's discuss and share :)
    Selamat datang kembali! Trimakasih telah menjadi bagian dari Komunitas Trader ini. Mari berdiskusi dan berbagi :)
    Dismiss Notice

adaptative profit target

Discussion in 'Belajar MQL dari Nol' started by Ludovic, 17 Jun 2024.

  1. Ludovic

    Ludovic Member Credit Hunter

    Equity
    Credit
    Ref Point
    Please i need help to code a correct adaptive profit in mql4
    actualy i'v done this script:
    extern double ProfitTarget=5;
    void OnTick()
    {
    if (ProfitTicks == true) {
    // Vérification du profit
    if (AccountProfit() > ProfitTarget) {
    CloseOrders();
    Print(" Profit Target TICKS is OK, Close All Orders ");
    Start = false;
    Sleep(300000);
    Start = true;
    }
    }
    }
    so when AccountProfit() is upper than ProfitTaget all the orders are closed by the CloseOrders() action
    I want to adaptive the ProfitTarget
    if AccountProfit() > ProfitTarget : ProfitTarget is now = ProfitTarget + 1
    if (AccountProfit() > initial ProfitTarget && AccountProfit()<= lastProfitTarget ) { CloseOrders();}
    to win all the Positive move of the profit and secure it to the last adaptative.
    so please if someone can help me to code that in mql4 i'll be very glad.
     

Share This Page