• 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 :)

adaptative profit target

Ludovic

Member
Credit Hunter
Credits
397
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.
 
Back
Top