1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. 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

Suggestion I will code your proven good strategy in to EA

Discussion in 'Expert Advisor atau Robot Forex' started by celakgede, 18 Jul 2020.

  1. markw118

    markw118 Member Credit Hunter

    Equity
    Credit
    Ref Point
    Garbage
     

    Attached Files:

    • Agree Agree x 1
  2. lIOVANNIX

    lIOVANNIX Member Credit Hunter

    Equity
    Credit
    Ref Point
    Thank you.
     
  3. lIOVANNIX

    lIOVANNIX Member Credit Hunter

    Equity
    Credit
    Ref Point
    Just checking. Anyone testing this? I have not have time much with it but its yet to open any trade for me yet,
     
  4. general_grievous

    general_grievous Member Credit Hunter

    Equity
    Credit
    Ref Point
    Greetings!

    Can you please add all notification toggles for push to text, popup, sound, and email.

    Buffers:
    Buy = 0
    Sell = 1

    Thank you!
     

    Attached Files:

  5. simba@190

    simba@190 New Member

    Equity
    Credit
    Ref Point
    hey i have something interesting .automating the quasimodo startegy
     
  6. Fian Alfarobi

    Fian Alfarobi New Member

    Equity
    Credit
    Ref Point
    thank you. how to enable the martingale?
     
  7. saint2545

    saint2545 Member Credit Hunter

    Equity
    Credit
    Ref Point
    Dear Tanaka, while I'm Back Test this EA_Stochastic divergence.ex4 , I have receive error message all the time...

    2023.05.30 03:49:16.671 cannot load 'C:\Users\saint2545\AppData\Roaming\MetaQuotes\Terminal\AC699DE519388DA6A82335C9CD38E506\MQL4\Experts\EA_Stochastic divergence.ex4::Indicators\!stochastic divergence mtf + alerts + arrows.ex4::Indicators\!stochastic divergence mtf + alerts + arrows.ex4'
    2023.05.30 03:49:16.671 cannot load resource 'C:\Users\saint2545\AppData\Roaming\MetaQuotes\Terminal\AC699DE519388DA6A82335C9CD38E506\MQL4\Experts\EA_Stochastic divergence.ex4::Indicators\!stochastic divergence mtf + alerts + arrows.ex4::Indicators\!stochastic divergence mtf + alerts + arrows.ex4'
     
  8. tanaka akiko

    tanaka akiko Well-Known Member Credit Hunter

    Equity
    Credit
    Ref Point
    Please use this indicator.
     

    Attached Files:

  9. candleman27

    candleman27 Member Credit Hunter

    Equity
    Credit
    Ref Point
    Hello

    I have a simple but profitable DAX strategy for someone to code, I've attached an example from the previous day where the long entry resulted in 15 pts and the short entry resulted in 135 pts and I have many other examples like that where this results in big winners

    The logic is based directly on Trader toms advanced school run strategy he's a multi million dollar 20yr veteran trader with his roots developed from Larry Pesaventos mentorship as well as a strong following of Al Brooks teaching


    For the logic:

    You simply watch the 4th bar on 5min chart form which gives you the breakout price range (range between 715-720 GMT just after Frankfurt open)

    If price breaks below we sell short / above we buy, with options for trailing stop with variable start and step values and auto lot function option based on the stop loss which will be placed opposite side of the established price range plus the spread

    We would like to have the option to add to winning trades with option for distance between additional orders

    We would like to see the option to increase lot size by a % for each additional order

    We would like to see the fixed take profit option able to somehow manage multiple orders as well as the trailing stop with the ability to manage all open orders

    The robot can only take one long and one short signal per day, however each signal could generate multiple open orders with the optional settings for adding to winners

    We would like to see the order to be entered the precise instant price crosses the specified range threshold, this has been an issue for the robot we have made currently and maybe we just need someone who can look with fresh eyes
     

    Attached Files:

    Last edited: 30 May 2023
  10. candleman27

    candleman27 Member Credit Hunter

    Equity
    Credit
    Ref Point
    This is the logic I got from mql4programmer.com but it doesn't work

    /* Input Parameters */

    input int EntryHour = 7; // Hour to scan for trades

    input int EntryMinute = 20; // Minute of hour to scan for trades

    input int BarsToScan = 1; // Number of previous bars to scan

    input double RiskPercent = 1; // Lot size based on % risk

    input double MaxLotSize = 10; // Maximum lot size used for trades

    input double LotSize = 0.01; // Fixed lot size used for trades

    input bool UseFixedLotSize = false; // Option to use fixed lot size instead of risk %

    input double LotSizePercentIncrease = 10; // % increase for lot size when adding to winning trades

    input double DistanceBetweenOrders = 10; // Distance between additional orders in points

    input int StopLoss = 50; // Fixed stop loss in points

    input bool UseTrailingStop = true; // Option to use trailing stop

    input int TrailingStart = 20; // Trailing stop start in points

    input int TrailingStep = 20; // Trailing stop step in points

    input int StopBuffer = 2; // Buffer added to stop loss

    input bool ShowMaxFloatingLoss = true; // Option to show max floating loss on screen

    input bool ShowProfit = true; // Option to show profit on screen

    input bool ShowWinPercentage = true; // Option to show win percentage on screen

    input bool ShowConsecutiveWins = true; // Option to show consecutive wins on screen

    input bool ShowConsecutiveLosses = true; // Option to show consecutive losses on screen

    input int GMTOffset = 0; // GMT offset for broker time (in hours)



    /* Global Variables */

    double Lots;

    double StopLossPrice;

    double TakeProfit;

    double LastTradePrice;

    double FloatingProfit;

    double MaxFloatingLoss;

    double RiskAmount;

    int NumberOfWinningShortTrades;

    int NumberOfWinningLongTrades;

    int ConsecutiveWins;

    int ConsecutiveLosses;



    /* Trading Functions */

    void OpenPosition(int type) {

    int ticket;

    if (type == OP_SELL) {

    ticket = Sell(Lots);

    LastTradePrice = Bid;

    NumberOfWinningShortTrades++;

    } else if (type == OP_BUY) {

    ticket = Buy(Lots);

    LastTradePrice = Ask;

    NumberOfWinningLongTrades++;

    }

    if (ticket > 0) {

    if (UseTrailingStop) {

    if (type == OP_SELL) {

    // Set initial trailing stop for sell trade

    SetTrailingStop(ticket, LastTradePrice - TrailingStart * _Point, TrailingStep * _Point);

    } else if (type == OP_BUY) {

    // Set initial trailing stop for buy trade

    SetTrailingStop(ticket, LastTradePrice + TrailingStart * _Point, TrailingStep * _Point);

    }

    }

    // Set stop loss and take profit levels for the trade

    SetStopLoss(ticket, StopLossPrice);

    SetTakeProfit(ticket, TakeProfit);

    }

    }

    void ClosePosition(int ticket) {

    // Close the trade

    if (ticket > 0) {

    CloseTrade(ticket);

    }

    // Reset trade variables

    LastTradePrice = 0;

    FloatingProfit = 0;

    StopLossPrice = 0;

    TakeProfit = 0;

    // Update consecutive wins/losses counter

    if (ticket > 0) {

    ConsecutiveWins++;

    ConsecutiveLosses = 0;

    } else {

    ConsecutiveLosses++;

    ConsecutiveWins = 0;

    }

    }



    /* Event Functions */

    void OnTick() {

    int hour = TimeHour(TimeCurrent()) - GMTOffset;

    int minute = TimeMinute(TimeCurrent());

    int allowedHour = EntryHour - GMTOffset;

    int allowedMinute = EntryMinute;

    // Only scan for trades at specified time

    if (hour != allowedHour || minute != allowedMinute) {

    return;

    }

    // Calculate the breakout price range

    int barsBack = BarsToScan + 1;

    double rangeLow = Low[barsBack];

    double rangeHigh = High[barsBack];

    for (int i = barsBack; i > 0; i--) {

    if (Low < rangeLow) {

    rangeLow = Low;

    }

    if (High > rangeHigh) {

    rangeHigh = High;

    }

    }

    // Check for sell signal

    if (Bid < rangeLow) {

    // Calculate lot size

    if (UseFixedLotSize) {

    Lots = LotSize;

    } else {

    RiskAmount = AccountBalance() * RiskPercent / 100;

    Lots = RiskAmount / StopLossPrice / 10000;

    if (Lots > MaxLotSize) {

    Lots = MaxLotSize;

    }

    }

    // Calculate stop loss and take profit

    StopLossPrice = rangeHigh + StopBuffer * _Point;

    TakeProfit = Bid - (StopLossPrice - Bid) * 2;

    // Open sell position

    if (OrderType() == -1) {

    // Close existing sell trade if present

    int ticket = OrderTicket();

    if (ticket > 0) {

    ClosePosition(ticket);

    }

    } else {

    OpenPosition(OP_SELL);

    }

    }

    // Check for buy signal

    if (Ask > rangeHigh) {

    // Calculate lot size

    if (UseFixedLotSize) {

    Lots = LotSize;

    } else {

    RiskAmount = AccountBalance() * RiskPercent / 100;

    Lots = RiskAmount / (Ask - StopLossPrice) / 10000;

    if (Lots > MaxLotSize) {

    Lots = MaxLotSize;

    }

    }

    // Calculate stop loss and take profit

    StopLossPrice = rangeLow - StopBuffer * _Point;

    TakeProfit = Ask + (Ask - StopLossPrice) * 2;

    // Open buy position

    if (OrderType() == -1) {

    OpenPosition(OP_BUY);

    } else {

    // Close existing buy trade if present

    int ticket = OrderTicket();

    if (ticket > 0) {

    ClosePosition(ticket);

    }

    }

    }

    }

    void OnTrade() {

    int ticket;

    double openPrice;

    double closePrice;

    double lotSize;

    int type;

    // Loop through all trades and update floating profit

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

    if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {

    ticket = OrderTicket();

    openPrice = OrderOpenPrice();

    lotSize = OrderLots();

    type = OrderType();

    if (type == OP_SELL) {

    if (UseTrailingStop) {

    // Update trailing stop for sell trade

    SetTrailingStop(ticket, openPrice - TrailingStart * _Point, TrailingStep * _Point);

    }

    if (Bid < openPrice) {

    // Close sell trade due to opposite signal

    ClosePosition(ticket);

    } else {

    // Update stop loss and take profit for sell trade based on average open price

    FloatingProfit += (openPrice - Bid) * lotSize;

    StopLossPrice = openPrice + (FloatingProfit / OrdersTotal() - StopBuffer * _Point);

    SetStopLoss(ticket, StopLossPrice);

    SetTakeProfit(ticket, LastTradePrice - (StopLossPrice - LastTradePrice) * 2);

    }

    } else if (type == OP_BUY) {

    if (UseTrailingStop) {

    // Update trailing stop for buy trade

    SetTrailingStop(ticket, openPrice + TrailingStart * _Point, TrailingStep * _Point);

    }

    if (Ask > openPrice) {

    // Close buy trade due to opposite signal

    ClosePosition(ticket);

    } else {

    // Update stop loss and take profit for buy trade based on average open price

    FloatingProfit += (Ask - openPrice) * lotSize;

    StopLossPrice = openPrice - (FloatingProfit / OrdersTotal() + StopBuffer * _Point);

    SetStopLoss(ticket, StopLossPrice);

    SetTakeProfit(ticket, LastTradePrice + (LastTradePrice - StopLossPrice) * 2);

    }

    }

    }

    }

    // Add to winning trades if distance between orders is reached

    if (FloatingProfit >= DistanceBetweenOrders * OrdersTotal() * _Point) {

    if (OrderType() == OP_SELL) {

    // Add sell order below current market price

    int ticket = Sell(Lots * (1 + LotSizePercentIncrease / 100.0), 0, Ask - DistanceBetweenOrders * _Point, 0, 0, 0);

    LastTradePrice = OrderOpenPrice();

    FloatingProfit = 0;

    } else if (OrderType() == OP_BUY) {

    // Add buy order above current market price

    int ticket = Buy(Lots * (1 + LotSizePercentIncrease / 100.0), 0, Bid + DistanceBetweenOrders * _Point, 0, 0, 0);

    LastTradePrice = OrderOpenPrice();

    FloatingProfit = 0;

    }

    }

    // Update max floating loss

    double floatingLoss = AccountBalance() - (FloatingProfit + Profit());

    if (floatingLoss < MaxFloatingLoss) {

    MaxFloatingLoss = floatingLoss;

    }

    }

    void OnInit() {

    // Set variables initial values

    LastTradePrice = 0;

    FloatingProfit = 0;

    MaxFloatingLoss = 0;

    NumberOfWinningShortTrades = 0;

    NumberOfWinningLongTrades = 0;

    ConsecutiveWins = 0;

    ConsecutiveLosses = 0;

    // Calculate stop loss price buffer as points

    StopBuffer = StopLoss / _Point;

    }

    void OnDeinit(const int reason) {

    // Print statistics on screen when EA is closed

    if (reason == REASON_REMOVE || reason == REASON_CHARTCHANGE || reason == REASON_ACCOUNT) {

    if (ShowProfit) {

    Pr
    int("Profit: ", NormalizeDouble(Profit(), 2));

    }

    if (ShowMaxFloatingLoss) {

    Print("Max Floating Loss: ", NormalizeDouble(MaxFloatingLoss, 2));

    }

    if (ShowWinPercentage) {

    Print("Winning Short Trades: ", NumberOfWinningShortTrades, "%\n");

    Print("Winning Long Trades: ", NumberOfWinningLongTrades, "%\n");

    }

    if (ShowConsecutiveWins) {

    Print("Consecutive Wins: ", ConsecutiveWins);

    }

    if (ShowConsecutiveLosses) {

    Print("Consecutive Losses: ", ConsecutiveLosses);

    }

    }

    }
     
  11. candleman27

    candleman27 Member Credit Hunter

    Equity
    Credit
    Ref Point
    Another 106pt winner
     

    Attached Files:

  12. loverhh

    loverhh Well-Known Member Credit Hunter

    Equity
    Credit
    Ref Point
    tanaka akiko

    Hi Tanaka my old friend, can you gave a deep look at this strategy? because it is worth..
    Please implement in the template already, the SELL BUY Limit at the block extreme and the SL at the block opposite.. eventually... put a trailing system too and stop trading not after xy time.. so if the price range many hours in the range of the block.. the ea dont open like a stupid always a trade :)

    Thx in advance my old friend
     
    • Like Like x 1
  13. loverhh

    loverhh Well-Known Member Credit Hunter

    Equity
    Credit
    Ref Point
    and as a risk management.. better to setup the EA so... not only based on Balance.. but based on the SL.. to lose max 1% of the balance.. so if one trade goes wrong.. you know.. you can lose only 1% of your balance... if you put lotsize based on Balance... but the SL one time 20 pips.. you lose X USD... but if the SL is 60 pips.. because the block is big.. you lose 3times X USD... and that you can burn fast your account
     
    • Like Like x 1
  14. tanaka akiko

    tanaka akiko Well-Known Member Credit Hunter

    Equity
    Credit
    Ref Point
    What EA is it?
     
  15. candleman27

    candleman27 Member Credit Hunter

    Equity
    Credit
    Ref Point
    He's talking about ea Frankfurt the DAX robot should be called the ASR robot for the Advanced School Run strategy tho;)
     
  16. zuko zk

    zuko zk Member Credit Hunter

    Equity
    Credit
    Ref Point
    your photo above doesn't look like what you explained
     
  17. candleman27

    candleman27 Member Credit Hunter

    Equity
    Credit
    Ref Point
    However it definitely is exactly that my broker is+3 gmt
     
  18. loverhh

    loverhh Well-Known Member Credit Hunter

    Equity
    Credit
    Ref Point
    and when i try to backtest your Frankfurt EA... after it take 1 trade.. it isnt opening anymore new trade... better is.. if cross BUY or SELL... he has to take both... both trades has SL.. also no problem.. and the winning one.. will be squeezed out with the trailing system
     
  19. candleman27

    candleman27 Member Credit Hunter

    Equity
    Credit
    Ref Point
    it may be stopped out is why it only takes one trade possibly, what risk settings are you using? You really cant rely on that robot because it doesnt enter at the target line, you never know how far away it will enter from the signal. Many times the breakout will result in a small long position and a big short position winner or the opposite of this with some kind of trailing logic enabled, and the current edition of the ea frankfurt robot will not take both signals, nor will it place the stop at the opposite end of the specified price range so we are forced to used a set sl dist. The best we can do with it for now is run it on m1 so it enters on the next 1min candle close, but that can still be 10 or 40 points away from the signal price... still needs tuning and my previous posted backtests are totally unreliable due to very short timeframe and just a curve fit which means nothing for future conditions unfortunately.
     
  20. candleman27

    candleman27 Member Credit Hunter

    Equity
    Credit
    Ref Point
    Once we can get the operational characteristics tuned we can start to optimize for other indices and even for other forex pairs etc, any instrument deserves a good backtest with this strategy, breakouts are a very popular option to trade the market open..

    ForexFiv works similarly however it doesnt have the option to set a specified entry time etc... all the logic is pretty locked down...
     

Share This Page