• Home
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • User/Email: Password:
  • 9:54pm
Menu
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • 9:54pm
Sister Sites
  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Options

Bookmark Thread

First Page First Unread Last Page Last Post

Print Thread

Similar Threads

ECN && STP && Scalping && Hedging - Broker Review - Oct 2009 24 replies

Trade & Trader Idea, Concept & Circumstances 26 replies

Long term, Low yielding "safe" forex investing 3 replies

Exporting & importing Global variables to CSV Files 3 replies

GBPJPY Top & EJ 3 replies

  • Trading Journals
  • /
  • Reply to Thread
  • Subscribe
  • 39
Attachments: R&D
Exit Attachments

R&D

  • Last Post
  •  
  • Page 1 2
  • Page 1 2
  •  
  • Post #1
  • Quote
  • First Post: Edited Aug 10, 2021 5:48pm Aug 9, 2021 6:16am | Edited Aug 10, 2021 5:48pm
  •  FunkyKoval
  • | Joined Nov 2018 | Status: Member | 230 Posts
Hi,
In this thread, I would like to share with you various hypotheses, research and discoveries

About me:
1. I have been dealing with Forex for three years without much success in "Forex business"
2. I am a seeking (so far) trader
3. I can program, but it's more of a junior / medium level
4. Forex and its research is my hobby so far

Rules in this thread:
1. We don't attack the person, we attack the problem
2. We respect each other, and we respect that everyone has the right to their point of view
3. I am not able to check, analyze or program everything.
Therefore, I leave myself free to choose theses and research them.

Current backlog:
1. Random Entry - done, tested
2. Reverse Entry - done, tested
3. Trailling Stop based on Volatility - done
- APV with constant APV Factor

4. Price action & trend detection - to do
a) AMA (EMA with dynamic speed) + AMA gradient - in progress
b) n-MAs cross - suspended
c) price consolidation towards MA - suspended
d) Price Cross MA + MA gradient - refactoring needed. First version made in AAC, but entry rules are needed beacuse something mixed up in the conditions.

5. Fixed position size vs% of equity - done
a) with a model that TP / SL 1.0 and Win / Loss 50/50 both work similarly
b) the fixed position model works better with TP / SL <1.0 and Win / Loss <50/50
c) the% equity model works for TP / SL> 1.0 and Win / Loss> 50/50.
For such a strategy, a fixed position does not "squeeze" real gains.

6. Simple simulation of forex games
a) Better understanding of random events, time series and statistical impact on the results of the strategy
b) Hundreds of balance curve generation model for better strategy modeling

7. Adding positions to profitable swing

8. "Dynamic APV Factor" depending on the type of cycles in the market.

9. Detecting of cycle of market type: flat, trending
  • Post #2
  • Quote
  • Edited at 3:28pm Aug 9, 2021 3:02pm | Edited at 3:28pm
  •  FunkyKoval
  • | Joined Nov 2018 | Status: Member | 230 Posts
Today R&D inspired by research: Grebenev Slava

EA rules:
1. When a new candlestick appears and there is no open positions randomly open a buy or sell position with 0.1 lot, without SL and TP

2. Dynamic Trailling Stop proportional to the average price volatility (APV) of the last five candles

3. APV is multiplied by an arbitrary / intuitive factor 5

Comments:
1. APVFactor it would be best to do n-hundreds of optimization runs and choose a coefficient from a range, so as not to relate it to specific historical data

2. It is worth checking live on the chart while the EA is operating, how TS behaves when there is a trend, flat and high and low volatility.
The adopted TS model tries to cut losses quickly when there is no trend, and to keep long positions when there is a trend.

3. It is interesting to test a simple input model: random or inverse (first buy, next next opposite to the previous one)

4. For me, the most interesting thing was generating balance curves. I realized that the balance curve depends on the sample of given model entry/exit and its time.
A simple mistake, a platform error and a failure to open a position or a bad close already affects the future of the balance curve history - like the butterfly effect.
Even for the same model of entry/exit, by changing the first entry or its moment by even an hour, we are changing the entire future history of the balance curve.

5. For this reason, for is more interested an entry/exit model that can react 100% to the price system itself, which does not require optimization or arbitrary parameters.

Comparing to driving a car:
1. It is impossible to drive a car looking in the rear mirror or the displayed image with a delay of a few seconds
2. The driver knows a number of techniques and tools that allow us to react without undue delay to the circumstances on the road ahead. It is even ready for emergencies. After recognizing them, he uses appropriate driving techniques.

I am curious about your observations and thoughts and conclusions from playing with this simple EA.

I am leaving you the source code, binary version and the last test report with profit! .. but this is only one of the millions of possible endings to this game

Attached Image (click to enlarge)
Click to Enlarge

Name: b68c6804a1eecea0112192a59c9755e9.png
Size: 64 KB
Attached Image (click to enlarge)
Click to Enlarge

Name: ac832391d2b50d58ff1982cf9175699c.png
Size: 45 KB

Attached File
File Type: ex5 Digger_R&amp;D_AAA.ex5   30 KB | 23 downloads
Attached File
File Type: mq5 Digger_R&amp;D_AAA.mq5   4 KB | 35 downloads

I invite you to a creative discussion.
Attached Image
 
 
  • Post #3
  • Quote
  • Aug 10, 2021 3:53am Aug 10, 2021 3:53am
  •  TeChaoLiang
  • Joined Feb 2021 | Status: Member | 342 Posts
Hi, FunkyKoval,

Your trailing stop performs very well. What the different between your APV and ATR? Could it is possible using ATR instead APV?
Because I only coding MQL4 so far, I read your mq5 code and rewrite the trailing stop part into a EA under developing.

Cheers
 
1
  • Post #4
  • Quote
  • Aug 10, 2021 7:10am Aug 10, 2021 7:10am
  •  FunkyKoval
  • | Joined Nov 2018 | Status: Member | 230 Posts
Hi, TeChaoLiang,

It's great that you like this Trailing Stop model. Feel free to engage in interactive discussions.

I decided to invest more time in understanding and using it better.
When writing the model, I mean: The method of calculating the variability and the very conditions of its running, i.e. when the change occurs.

The adopted model of calculating volatility is very similar to ATR, if not the same as in ATR
I am counting the sum of the High and Low differences for n-last candles, and divide by their number.
The ATR counts the same sums, but the highest values are taken from (H-L) ABS (H - CP) ABS (L-CP)
Im using my sum, because it was easier for me to code it than to use a ready indicator. Besides, I have somehow that I prefer myself

Nevertheless, I think that the logic (rulse) of the model is most important. Is not obviouse

TS changes only when the distance between the current SL and Bid/Ask is greater than five times the Volatility.
And once it changes, it changes to be these five Volatility distances away.

In other words, the model is non-linear, because if the current price pops up, but the volatility is high, TS does not change.

I am thinking about visualizing this function somehow: Ask / Bid, CurrentSL, Volatility * 5. But so far I have no idea

However, when, after a price jump, the price begins to accumulate (volatility decreases) and SL moving.
It's as TS Model was detecting post-swing consolidation, securing profit, but giving you a chance for two options:
a) if the price goes further after consolidation, TS will give this possibility
b) if price decide to turn back after the price consolidation, TS minimizes the losses very much

PS. in my opinion, MQL5 is much simpler and gives more possibilities than MQL4

I am also adding a new version Digger R&D AAB:
1. Here the input is set to inverse, but it doesn't matter for testing TS anyway.
2. Fixed some bugs that gave alerts during testing
3. Added display of values on the "journal" tab
Attached Files
File Type: ex5 Digger_R&amp;D_AAB.ex5   32 KB | 28 downloads
File Type: mq5 Digger_R&amp;D_AAB.mq5   5 KB | 28 downloads
 
 
  • Post #5
  • Quote
  • Edited at 10:40am Aug 10, 2021 10:12am | Edited at 10:40am
  •  FunkyKoval
  • | Joined Nov 2018 | Status: Member | 230 Posts
During the testing of Trailling Stop based on APV, I prepared Digger R&D version of AAC with opening position after crossing MA by price and given gradient.

I want to investigate whether at least a minimal "statistical advantage" and trading with the trend gives anything.

Quick development. I ran the first test quickly, without any optimizations.

1. APVFactor = 5 (as ususual)
2. SMA 8, shift 5, median price (because I like it)

You can see the raw model struggling with the market and reacting to flat periods and trends.

Test yourself at different times and see how the whole model responds.
There are times of worse and better. Traditionally, the current cycle and the balance curve depend from the starting point. I am testing further.

Attached Image (click to enlarge)
Click to Enlarge

Name: f4d9eb7f5fc65615dd0af31ae591f481.png
Size: 57 KB

Attached Image (click to enlarge)
Click to Enlarge

Name: ed52d6ab2a5c2560ef70c1fb5c92cea1.png
Size: 71 KB



The following are especially interesting:
1. Profit Factor
2. Recovery Factor
3. Z-score (positive) loss make loss, profit make profit with 99% probability
4. Win / Loss ration is low, therefore I cannot use the dynamic% lot size.
I don't know, but this could be a issue of the trend-following strategy


PS. I cannot attach a full HTML test report because these files are locked on this form. Do you know how to deal with it?

Digger R&D AAC:
1. Trade function based on MA Cross with gradient
2. Trailling Stop same as in AAB
3. I added input: open multi & bi-direct positions allowed / not allowed.

Attached File
File Type: ex5 Digger_R&amp;D_AAC.ex5   53 KB | 30 downloads
Attached File
File Type: mq5 Digger_R&amp;D_AAC.mq5   16 KB | 27 downloads
 
2
  • Post #6
  • Quote
  • Aug 10, 2021 4:00pm Aug 10, 2021 4:00pm
  •  TeChaoLiang
  • Joined Feb 2021 | Status: Member | 342 Posts
Quoting FunkyKoval
Disliked
I am thinking about visualizing this function somehow: Ask / Bid, CurrentSL, Volatility * 5. But so far I have no idea However, when, after a price jump, the price begins to accumulate (volatility decreases) and SL moving. It's as TS Model was detecting post-swing consolidation, securing profit, but giving you a chance for two options: a) if the price goes further after consolidation, TS will give this possibility b) if price decide to turn back after the price consolidation, TS minimizes the losses very much PS. in my opinion, MQL5 is much simpler...
Ignored
I had tested your TS logic on my 2 EAs, they are all for XauUsd. One is designed for trending market, the other is for ranging market. I found that TS model works great on ranging market but not so well on trending market. The reason I think, normally in a trending market, the retrace range is also larger. If employ TS model, the retrace is very easy to hit SL, and stop gaining the potential profit. That is, when market is in trending trailing stop should be not too closer to the market price.

Also, to prevent from too frequently modifying orders, I use 20 as the SLFactor.
 
1
  • Post #7
  • Quote
  • Aug 10, 2021 4:43pm Aug 10, 2021 4:43pm
  •  TeChaoLiang
  • Joined Feb 2021 | Status: Member | 342 Posts
Quoting FunkyKoval
Disliked
PS. I cannot attach a full HTML test report because these files are locked on this form. Do you know how to deal with it?
Ignored
You have to compress the HTML test report to a zip file and upload.

BTW, the test report I attach is using APV as TS. The EA is designed for running in ranging market. When using APV as TS, the drawdown percentage is reduced and the profit is increased.

However, when using APV TS on another EA, which is designed for trending market, the drawdown percentage is increased and the profit is reduced. Although the EA is still profitable.

Attached File
File Type: zip RS_Ranging 1.1.zip   14 KB | 42 downloads
 
1
  • Post #8
  • Quote
  • Aug 10, 2021 5:38pm Aug 10, 2021 5:38pm
  •  FunkyKoval
  • | Joined Nov 2018 | Status: Member | 230 Posts
Hi TeChaoLiang,

Many thanks for your input and analysis.

The interesting thing is that you found that this APV TS model works more in the ranging market than in the trend one.
I honestly thought that it works more with the trend on the market but maybe I did not do enough tests.

I don't know if I see correctly, but you tested on M1 (?)
IMHO on M1 it's hard to build a trend so that APV TS model inertia cannot handle it well.
If that's ok for you, then I suggest you test the minimum on M15 and preferably on H1, but no more than D1.

Maybe we have some new R&D area "Dynamic AVP Factor" depending on the type of cycles in the market.
Detecting of cycle of market type I have in backlog, I found some interesting indi.
I added to the backlog (post #1)

Nevertheless, my idea currently revolves around the following:
1. I have an Adaptive to Volatility TS
2. I need a trend filter, I chose AMA (flat on ranging, with slope on trend)
3. I need rules on signal. I am currently working on an AMA gradient.
AMA has great properties and theoretically discounts and gives a net price, so may be tempted to give up price action.

In the meantime, while we are discussing this, I have prepared a Digger R&D version of the AAD:
1. Trend is based on Adaptive MA
2. Entry, AMA is up or down in this version. So far it gives a lot of false signals, because it is a trivial signal. Gradient in the next versions.
3. Take Profit = Trailing stop according to APV Model
Attached Files
File Type: ex5 Digger_R&amp;D_AAD.ex5   35 KB | 35 downloads
File Type: mq5 Digger_R&amp;D_AAD.mq5   5 KB | 31 downloads
 
 
  • Post #9
  • Quote
  • Aug 10, 2021 5:51pm Aug 10, 2021 5:51pm
  •  TeChaoLiang
  • Joined Feb 2021 | Status: Member | 342 Posts
Quoting FunkyKoval
Disliked
I don't know if I see correctly, but you tested on M1 (?) IMHO on M1 it's hard to build a trend so that APV TS model inertia cannot handle it well. If that's ok for you, then I suggest you test the minimum on M15 and preferably on H1, but no more than D1.
Ignored
I run back test using M1 history data, but in my EA is using fix time frame of M5. I always select M1 for back test, but my EA is not set to current time frame.

Quoting FunkyKoval
Disliked
Maybe we have some new R&D area "Dynamic AVP Factor" depending on the type of cycles in the market. Detecting of cycle of market type I have in backlog, I found some interesting indi. I added to the backlog (post #1) Nevertheless, my idea currently revolves around the following: 1. I have an Adaptive to Volatility TS 2. I need a trend filter, I chose AMA (flat on ranging, with slope on trend) 3. I need rules on signal. I am currently working on an AMA gradient. AMA has great properties and theoretically discounts and gives a net price, so may be...
Ignored
The new area is worth to study.
 
1
  • Post #10
  • Quote
  • Aug 11, 2021 2:29am Aug 11, 2021 2:29am
  •  FunkyKoval
  • | Joined Nov 2018 | Status: Member | 230 Posts
Quoting TeChaoLiang
Disliked
{quote} I run back test using M1 history data, but in my EA is using fix time frame of M5. I always select M1 for back test, but my EA is not set to current time frame. {quote}.
Ignored
For what reason you take it like that? if this is your assumed strategy, then you need to develop the whole model further and looking for trading edge. IMHO on m1 i much harder. And if a technical matter, maybe it is worth working on it
 
 
  • Post #11
  • Quote
  • Aug 11, 2021 4:07am Aug 11, 2021 4:07am
  •  LadyAmira
  • | Joined May 2016 | Status: Member | 51 Posts
Hi FunkyKoval, very interesting thread. Did you try Waddah Attar Explosion as a trend filter? Also a good one.
Attached File
File Type: mq4 waddah attar explosion averages nmc alerts 2_2.mq4   32 KB | 45 downloads
 
1
  • Post #12
  • Quote
  • Aug 11, 2021 4:16am Aug 11, 2021 4:16am
  •  LadyAmira
  • | Joined May 2016 | Status: Member | 51 Posts
For opening trades just an idea: when RSI is reaching 70 and 30 zone?
Attached Image (click to enlarge)
Click to Enlarge

Name: _9889.png
Size: 22 KB
 
1
  • Post #13
  • Quote
  • Aug 11, 2021 5:32am Aug 11, 2021 5:32am
  •  TeChaoLiang
  • Joined Feb 2021 | Status: Member | 342 Posts
Quoting FunkyKoval
Disliked
{quote} For what reason you take it like that? if this is your assumed strategy, then you need to develop the whole model further and looking for trading edge. IMHO on m1 i much harder. And if a technical matter, maybe it is worth working on it
Ignored
Yes. it is a technical metter.
When you running a back test, you had better choose M1 time frame no matter what time frame you use in your EA for indicators. The simulated tick value or using the historical tick data will accurate respond to your trade. Therefor, when doing a forward test on a demo account, I can choose any time frame I like and the result won't be different. The indicators in the EA always take the index value from the given time frame I set to the indicator, won't affected by the current time frame of your chart.
Note that, I am not using M1 time frame for my indicators. Even, sometime I will use a large time frame for some indicators but my other indicator's time frames are far smaller than the large time frame. Only if you have set a fix time frames for the indicators, the running result is irrelevant to what the time frame of the chart you are running the EA.
 
1
  • Post #14
  • Quote
  • Aug 11, 2021 5:33am Aug 11, 2021 5:33am
  •  FunkyKoval
  • | Joined Nov 2018 | Status: Member | 230 Posts
Quoting LadyAmira
Disliked
Hi FunkyKoval, very interesting thread. Did you try Waddah Attar Explosion as a trend filter? Also a good one. {file}
Ignored
Thanks for the vote and appreciating the thread

I haven't met this indicator, would you be able to write here and explain its idea and principle of working ? thx in advance for your commitment and time
 
 
  • Post #15
  • Quote
  • Aug 11, 2021 5:35am Aug 11, 2021 5:35am
  •  FunkyKoval
  • | Joined Nov 2018 | Status: Member | 230 Posts
Quoting TeChaoLiang
Disliked
{quote} When you running a back test, you had better choose M1 time frame no matter what time frame you use in your EA for indicators. The simulated tick value or using the historical tick data will accurate respond to your trade. Therefor, when doing a forward test on a demo account, I can choose any time frame I like and the result won't be different. The indicators in the EA always take the index value from the given time frame I set to the indicator, won't affected by the current time frame of your chart. Note that, I am not using M1 time frame...
Ignored
oh, ok this is price generating in MT Tester - thanks in advance for your commitment and time.
Thanks for the clarification, I use ticks, but actually for testing better to use m1 candles generator.
 
 
  • Post #16
  • Quote
  • Aug 11, 2021 5:59am Aug 11, 2021 5:59am
  •  FunkyKoval
  • | Joined Nov 2018 | Status: Member | 230 Posts
Today's thoughts:

1. I am not looking for the perfect and nirvana model of EA
2. Each EA model has advantages and disadvantages. And there is no point in wasting time settling it.
3. I want to adopt one model and master its capabilities.
4. I would like to be able to confirm the optimum of a given EA model empirically, probably referring to the statistics of the stochastic price / balance curve process for millions of series. To be invented.

So far my choices:
1. Adaptive Moving Average - it's worth taking a moment to deep dive on it. In fact, the AMA is a model for two EMAs (slow and fast) that are turned on / off depending on the "current" direction and volatility. AMA realizes my basic assumption that it is an adaptive model. Of course, you can probably judge why there are only two EMAs, not the n-EMA, why this period for slow and fast. You can, but let's check it first for the basic version, and if necessary, we will generalize it.

2. Trailling Stop model based on linear variability.

3. Now I'm working on the input signal according to AMA gradient.
 
 
  • Post #17
  • Quote
  • Aug 11, 2021 6:07am Aug 11, 2021 6:07am
  •  LadyAmira
  • | Joined May 2016 | Status: Member | 51 Posts
Quoting FunkyKoval
Disliked
{quote} Thanks for the vote and appreciating the thread I haven't met this indicator, would you be able to write here and explain its idea and principle of working ? thx in advance for your commitment and time
Ignored
Mr. Waddah Attar himself explained:

  1. Red histogram shows the current down trend
  2. Green histogram shows the current up trend
  3. Yellow line's direction shows the explosion in price up or down
  4. The Waddah Attar Explosion is made to be used on the 30 minute chart


Signal for buy:

  1. Green histogram bar is up, the yellow line is up, and green histogram bar is higher than the yellow line.
  2. Trade can be exited when the green histogram bar drops lower than the yellow line.


Signal for sell:

  1. Red histogram bar is up, the yellow line is up, and red histogram bar is higher than the yellow line.
  2. Trade can be exited when the red histogram bar drops lower than the yellow line.


In my opinion it's a really good filter for EAs and I don't know why it's not often used, maybe it's not so well known. You can see on the 1 h or 4 h chart, that it'll help you to stay out of range markets. This indicator alone has great potential for an own EA (https://www.forexfactory.com/thread/...h-attar-win-ea), unfortunately it's not really developed with endurance.

 
 
  • Post #18
  • Quote
  • Aug 11, 2021 6:18am Aug 11, 2021 6:18am
  •  FunkyKoval
  • | Joined Nov 2018 | Status: Member | 230 Posts
LadyAmira thx a lot for you clarification.

Do you know what price / market mechanics this indicator uses?
 
 
  • Post #19
  • Quote
  • Aug 11, 2021 6:50am Aug 11, 2021 6:50am
  •  LadyAmira
  • | Joined May 2016 | Status: Member | 51 Posts
Quoting FunkyKoval
Disliked
LadyAmira thx a lot for you clarification. Do you know what price / market mechanics this indicator uses?
Ignored
Unfortunately not
 
 
  • Post #20
  • Quote
  • Edited at 2:52pm Aug 13, 2021 2:37pm | Edited at 2:52pm
  •  FunkyKoval
  • | Joined Nov 2018 | Status: Member | 230 Posts
While testing the AMA and TS model, I asked myself what was generating the price / current candlestick chart.

I don't know if I understand it correctly, but I get something like this:
1. In the Order Book we see buy / sell offers (no market orders are visible there)
2. Offers have price and volume (aggregated)
3. The market buyer / seller comes and places the order on the market, and the deal is carried out with the closest price from the offers "order book" and price moves to this place.

If this is true, then in special cases the price may be changed
a) by a large distance with a small amount of volume, or
b) by a small distance with a very large amount.

I started to wonder because the only thing that drives the price is the incoming on-market orders that fulfill the pending offers.
Offers may wait, be changed, etc., but these changes in the price itself do not change, only an incoming and executed on-market order causes it.

... and we do not see the on-market order itself, we do not know when it will come, with what volume and at what price.
I drew an example of the price movement in excel

I do not know if I understand it well and Im not sure it this can be somehow used. You probably already have it mastered

Attached Image (click to enlarge)
Click to Enlarge

Name: 1f2ceacccf4012fba1920fb731c9c1fa.jpeg
Size: 177 KB
 
1
  • Trading Journals
  • /
  • R&D
  • Reply to Thread
    • Page 1 2
    • Page 1 2
0 traders viewing now
  • More
Top of Page
Forex Factory Blog Updated: Alerting All Members
  • Facebook
  • Twitter
About FF
  • Mission
  • Products
  • User Guide
  • Media Kit
  • Blog
  • Contact
FF Products
  • Forums
  • Trades
  • Calendar
  • News
  • Market
  • Brokers
  • Trade Explorer
FF Website
  • Homepage
  • Search
  • Members
  • Report a Bug
Follow FF
  • Facebook
  • Twitter

FF Sister Sites:

  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Forex Factory® is a brand of Fair Economy, Inc.

Terms of Service / ©2022