Request for Assistance with EA Development

1
Hello everyone,

I've been working on integrating my trading strategy into an Expert Advisor (EA) for better back testing. My strategy utilizes three indicators: MACD, TMA Centered Bands, and Gann HiLo activator bars. Here's a detailed overview of the trade logic:

Trade Logic
1. MACD as the Trend Filter:
Custom Settings: Fast EMA (65), Slow EMA (75), Signal Line (35).
Bullish Trend: The signal line (35) is above the zero line.
Bearish Trend: The signal line (35) is below the zero line.
Purpose: Determines overall market sentiment (bullish or bearish) and serves as the basis for opening long or short positions.

2. TMA Centered Bands:
Upper Band Breakout:

Look for instances where the closing price of a candle crosses above the upper TMA band.
Indicates potential overbought conditions or strong bullish momentum.
Can be interpreted as a potential sell signal or a caution against further upward movement.

Lower Band Breakout:

Identify situations where the closing price of a candle crosses below the lower TMA band.
Indicates potential oversold conditions or strong bearish momentum.
Can be interpreted as a potential buy signal or a caution against further downward movement.

3. Gann HiLo Activator Bars:

Buy Signal Conditions:

The closing price of the current candle crosses above the high value calculated by the Gann HiLo indicator.
The previous candle's closing price was below the high value.
Optional additional confirmation (e.g., slope of a moving average, volume).
Sell Signal Conditions:

The closing price of the current candle crosses below the low value calculated by the Gann HiLo indicator.
The previous candle's closing price was above the low value.

Issues I'm Facing
I've managed to write some code for the trade logic execution, but I'm encountering several issues:

Trade Calculation: The calculation for the lot size based on the percentage risk is not working correctly.
Backtesting Problems: The backtests are not producing the expected results.
Platform Context: The EA is running on an offline chart that uses PointO Bars.
I've attached the code I've written so far. The code compiles correctly, but some functions are not working as intended.I would greatly appreciate any help or suggestions on how to get this EA working correctly, especially in terms of:

Correctly calculating lot sizes based on percentage risk.
Ensuring the trade logic executes as intended.
Improving the accuracy of back testing results.
Thank you in advance for your assistance!


Re: Request for Assistance with EA Development

2
brianzvc wrote: Sun May 26, 2024 1:54 am Hello everyone,

I've been working on integrating my trading strategy into an Expert Advisor (EA) for better back testing. My strategy utilizes three indicators: MACD, TMA Centered Bands, and Gann HiLo activator bars. Here's a detailed overview of the trade logic:

Trade Logic
1. MACD as the Trend Filter:
Custom Settings: Fast EMA (65), Slow EMA (75), Signal Line (35).
Bullish Trend: The signal line (35) is above the zero line.
Bearish Trend: The signal line (35) is below the zero line.
Purpose: Determines overall market sentiment (bullish or bearish) and serves as the basis for opening long or short positions.

2. TMA Centered Bands:
Upper Band Breakout:

Look for instances where the closing price of a candle crosses above the upper TMA band.
Indicates potential overbought conditions or strong bullish momentum.
Can be interpreted as a potential sell signal or a caution against further upward movement.

Lower Band Breakout:

Identify situations where the closing price of a candle crosses below the lower TMA band.
Indicates potential oversold conditions or strong bearish momentum.
Can be interpreted as a potential buy signal or a caution against further downward movement.

3. Gann HiLo Activator Bars:

Buy Signal Conditions:

The closing price of the current candle crosses above the high value calculated by the Gann HiLo indicator.
The previous candle's closing price was below the high value.
Optional additional confirmation (e.g., slope of a moving average, volume).
Sell Signal Conditions:

The closing price of the current candle crosses below the low value calculated by the Gann HiLo indicator.
The previous candle's closing price was above the low value.

Issues I'm Facing
I've managed to write some code for the trade logic execution, but I'm encountering several issues:

Trade Calculation: The calculation for the lot size based on the percentage risk is not working correctly.
Backtesting Problems: The backtests are not producing the expected results.
Platform Context: The EA is running on an offline chart that uses PointO Bars.
I've attached the code I've written so far. The code compiles correctly, but some functions are not working as intended.I would greatly appreciate any help or suggestions on how to get this EA working correctly, especially in terms of:

Correctly calculating lot sizes based on percentage risk.
Ensuring the trade logic executes as intended.
Improving the accuracy of back testing results.
Thank you in advance for your assistance!
(a) I'm not a moderator, but I'm posting this reply so you can comply to avoid getting banned.

(b) "Members must make an effort to participate, post, or share something (ie. your own indicator(s), files) before asking for coding work or modifications" (viewtopic.php?t=8472780).

(c) in any event, welcome to the best forex trading forum that exists.
“[A]s we know, there are known knowns—there are things we know we know. We also know there are known unknowns—that is to say we know there are some things we do not know. But there are also unknown unknowns—the ones we don’t know we don’t know.”—Donald Rumsfeld, 2002