Fix an EA that isn't performing in the Strategy Tester

仕事が完了した

実行時間3 日
開発者からのフィードバック
Good description of requirements specifications. Fast communication. Looking forward to working with you again

指定

The specifications:

This EA uses the RSI exclusively for trade opens and closes.  The RSI crosses 50 moving upward and alerts the EA to watch.  When it reaches 53 it triggers a buy order.  When the RSI reaches 70, it triggers a close order.  Conversely, when the RSI crosses 50 moving downward, it alerts the EA.  When it reaches 47 it triggers a sell order.  This order is closed at RSI 30.  There is also a contingency if the RSI crosses over the 50 moving the opposite direction that the trade would close.  

As much is in the existing code.

Currently, the EA will only open and close one trade in the Strategy Tester.  I would like you to modify the EA to operate according to these specifications.  

I would also like you to add a trailing stop that can be adjusted.


Here is the existing code:



// Global Variables

enum StateType {WATCHING, LONG_ENTRY, SHORT_ENTRY, CLOSE_TRADE};

StateType state = WATCHING;

double LotSize = 0.1;  // Lot size

double StopLoss = 20.0 * Point;  // Stop loss in price difference

double TakeProfit = 100.0 * Point;  // Take profit in price difference

int slippage = 3;

int RSI_Period = 14;


// OnTick function

void OnTick() {

    double currentRSI = iRSI(Symbol(), 0, RSI_Period, PRICE_CLOSE, 0);

    double previousRSI = iRSI(Symbol(), 0, RSI_Period, PRICE_CLOSE, 1);


    if (state == WATCHING) {

        if (currentRSI > 50 && previousRSI <= 50) {

            state = LONG_ENTRY;

        } else if (currentRSI < 50 && previousRSI >= 50) {

            state = SHORT_ENTRY;

        }

    }


    if (state == LONG_ENTRY && currentRSI >= 53) {

        PlaceLongOrder();

    } else if (state == SHORT_ENTRY && currentRSI <= 47) {

        PlaceShortOrder();

    }


    if (state == CLOSE_TRADE) {

        CloseTrade(currentRSI);

    }

}


// Function to place a long order

void PlaceLongOrder() {

    if (OrdersTotal() == 0) {

        double price = Ask;

        int ticket = OrderSend(Symbol(), OP_BUY, LotSize, price, slippage, price - StopLoss, price + TakeProfit, "Buy Order", 0, 0, clrGreen);

        if (ticket > 0) state = CLOSE_TRADE;

    }

}


// Function to place a short order

void PlaceShortOrder() {

    if (OrdersTotal() == 0) {

        double price = Bid;

        int ticket = OrderSend(Symbol(), OP_SELL, LotSize, price, slippage, price + StopLoss, price - TakeProfit, "Sell Order", 0, 0, clrRed);

        if (ticket > 0) state = CLOSE_TRADE;

    }

}


// Function to close the trade based on RSI

void CloseTrade(double currentRSI) {

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

        if (OrderSelect(i, SELECT_BY_POS) && OrderSymbol() == Symbol()) {

            if ((OrderType() == OP_BUY && currentRSI >= 70) || (OrderType() == OP_SELL && currentRSI <= 30)) {

                bool closed = OrderClose(OrderTicket(), OrderLots(), (OrderType() == OP_BUY ? Bid : Ask), 3, clrRed);

                if (closed) state = WATCHING;

            } else if ((OrderType() == OP_BUY && currentRSI < 50) || (OrderType() == OP_SELL && currentRSI > 50)) {

                closed = OrderClose(OrderTicket(), OrderLots(), (OrderType() == OP_BUY ? Bid : Ask), 3, clrRed);

                if (closed) state = WATCHING;

            }

        }

    }

}

    



応答済み

1
開発者 1
評価
(161)
プロジェクト
192
26%
仲裁
8
25% / 38%
期限切れ
5
3%
取り込み中
2
開発者 2
評価
(37)
プロジェクト
59
27%
仲裁
25
20% / 52%
期限切れ
10
17%
仕事中
3
開発者 3
評価
(2449)
プロジェクト
3086
66%
仲裁
77
48% / 14%
期限切れ
340
11%
4
開発者 4
評価
(11)
プロジェクト
27
30%
仲裁
3
0% / 0%
期限切れ
1
4%
多忙
5
開発者 5
評価
(14)
プロジェクト
18
67%
仲裁
2
50% / 50%
期限切れ
3
17%
6
開発者 6
評価
(2114)
プロジェクト
2684
62%
仲裁
114
46% / 25%
期限切れ
419
16%
多忙
7
開発者 7
評価
プロジェクト
0
0%
仲裁
0
期限切れ
0
8
開発者 8
評価
プロジェクト
0
0%
仲裁
1
0% / 100%
期限切れ
0
9
開発者 9
評価
(42)
プロジェクト
62
8%
仲裁
12
58% / 42%
期限切れ
1
2%
10
開発者 10
評価
(39)
プロジェクト
40
10%
仲裁
0
期限切れ
0
類似した注文
Enter buy trade at close of candle when bar closes above the 3 emas. Emas are 34 ema, 64 ema and 128 ema. For a buy trade the 34 ema must be above the other two emas. The 64 ema should be in the middle. The 128 ema should be below the other two emas. For a buy trade the Awesome Oscillator should be above the middle line and colored green. Exit a buy trade when price touches 64 ema. Sell trade same conditions as buy
I want to make AI based on Attached Picture Swing High low. If you have experience can share demo first. Stop loss, take profit, trailing , break even ,DD etc. also amiable
Hello, I’m looking for a TradingView indicator that fits my forex trading needs. If you can create or customize one for me, please reach out. I'd appreciate your help! Thanks in advance."
Pls I need help I don’t have much but pls accept my little payment for the work thanks 🙏 mt5 file Once it opens buy and move positively to buy let it use auto trailing to follow the trend that’s if I choose to use trailing option and before the trailing starts it must reach the actual profit target example if I set profit target to 500 then once profit is at 500 let trailing immediately protect it and any 1 pip
Hey greetings am in need of a developer that can convert my simple tradingview indicator to MT4 I have the source code of the indicator and is also a public indicator on Tradingview site Kindly bid and let started
Hello my developer colleagues, am also a developer like you but i just hear about this mql site and i will like to sell, develop and build bots for buyer. But i don't know how to become a seller here please i need help in helping me to create a seller account on mql and i will be very glad if you can help me out and i will appreciate you
Preciso de um EA que abra ordens a mercado a partir de um indicador, Ele precisa obter take e stop loss fixos, spread máximo, horários de início e final das operações, meta e stop diário, martingale, painel e a função no script para que eu possa ceder o EA apartir do id do mt4 de terceiros
Hello Investors, I'm selling a profitable and stable expert advisor trading on the Gold (XAUUSD) pair using a cutting-edge scalping strategy. The EA is able to generate a stable monthly income without using martingale strategy, and with an optional cut loss in place. Particularly the average monthly gain can go from 2-3% (at a relatively low risk, with an historical max DD of 6%) to 20-30% (with an aggressive style
can you help me with Ctrader i need modification on the linkhttps://docs.google.com/document/d/1fggk49xWbnwahtfOlE-U7G6muZB1FT8eWmftGiY7R-s/edit?usp=sharing can you assist with cTrader modifications to enhance functionality and improve performance. do text me if you a professional on it i will be looking forward to your response best regards
Would I honestly need is someone who can make a profitable EA for me that can at least make me around $80 a day starting with $50 and the EA must be able to work with exness the EA should automat trades 24/7. Broker = Exness Pairs = USD/JPY XAU/USD and etc Chart time frames = M1 M15 History = last month till last 6 months. Lot size 0.10 take profit at $2 stop

プロジェクト情報

予算
50+ USD
開発者用
45 USD
締め切り
最低 1 最高 5 日