Help needed - chart shows different trades than code

v88  
Hi,

I'm trying to check for a buy/sell position on 2 chart indicators and then attempting to wait X bars for rest of indicators to be true.

When I check the bars visually after a backtest, the trades seem to be totally not what I coded. I try to get the true condition of 2 chart indicators and then waiting for the rest with a counter. If the counter gets to X and still the trades are not true, then counter is reset.

Condition for buy trade is:

    Bottom indicator is in red, bollinger squeeze is in red
    Wait 5 bars, to see if AMA smoothe is green (2 window down after main chart) and aroon is above zero (1 window down after main chart)

Per the attached,  this is not the case but the EA traded. My code is attached too. Any ideas what is wrong or obvious code errors? Thanks.





Vladimir Karputov  
vertigo888 :
Hi,

I'm trying to check for a buy/sell position on 2 chart indicators and then attempting to wait X bars for rest of indicators to be true.

When I check the bars visually after a backtest , the trades seem to be totally not what I coded. I try to get the true condition of 2 chart indicators and then waiting for the rest with a counter. If the counter gets to X and still the trades are not true, then counter is reset.

Condition for buy trade is:

    Bottom indicator is in red, bollinger squeeze is in red
    Wait 5 bars, to see if AMA smoothe is green (2 window down after main chart) and aroon is above zero (1 window down after main chart)

Per the attached,  this is not the case but the EA traded. My code is attached too. Any ideas what is wrong or obvious code errors? Thanks.

Please attach the correct file (just in case - *.txt is an INCORRECT file FORMAT).

Copy Full Path

v88  
Vladimir Karputov #:

Please attach the correct file (just in case - *.txt is an INCORRECT file FORMAT).




Mq5 file attached, Thanks Vladimir. This code is driving me nuts. Not new to coding but new to mql5.

Files:
test8.mq5  61 kb
Vladimir Karputov  
vertigo888 # :


Mq5 file attached, Thanks Vladmir. This is driving me nuts. Not new to coding but new to mql5.

Million errors, won't compile:


v88  
Vladimir Karputov #:

Million errors, won't compile:



Apologies, forgot to include the includes.


mql5book.zip is coded to follow Mql5Book folder within include folder

trade.zip is coded to follow Trade folder within include (should be default files)

Files:
test8.mq5  61 kb
Mql5Book.zip  16 kb
Trade.zip  28 kb
v88  
vertigo888 #:


Apologies, forgot to include the includes.


mql5book.zip is coded to follow Mql5Book folder within include folder

trade.zip is coded to follow Trade folder within include (should be default files)

also the indicators within the indicators folder
Files:
Indicators.zip  319 kb
Vladimir Karputov  

Sorry, but again a million mistakes.

My advice: create a minimal example that consists of a single file.

v88  
Vladimir Karputov #:

Sorry, but again a million mistakes.

My advice: create a minimal example that consists of a single file.

Hi,

Did a stripped down version as much as I could without it being too simple to not replicate the issue I am having. Copy the zip contents to your metaeditor directory, as the folder structure has been preserved. Compiled on a fresh version of MT5 with another broker as well to make sure and works fine.


EA is called test9 and uses the code that you previously helped me with in another thread. Same issue happens again. The bottom indicator window (trend trigger) in the attached screenshot is supposed to be red and within 5 bars later other criteria is checked.

Vladimir Karputov  

You are creating the 'Trend trigger factor - mtf' indicator WRONG.

You need to be more careful with the input parameters.

v88  
Vladimir Karputov #:

You are creating the 'Trend trigger factor - mtf' indicator WRONG.

You need to be more careful with the input parameters.

Thanks - silly error on my part really.


I believe i've fixed this and then I removed all logic. The call is now


handle_iCustom3 = iCustom(_Symbol,_Period,"Trend trigger factor - mtf",inpTrendTimeFrame,inpTrendPeriod,inpTrendT3Period,inpTrendT3Hot,inpTrendT3Type,inpTrendLevels,inpTrendInterpolate);


The script is just looking for the colours now (see code attached, please use in line with the other includes I attached before) -  Red  Buy (valc_tr[0] ==2) or Blue Sell (valc_tr[0] == 1) but the trades do not seem to match up to this logic. Is there anything else wrong or that does not look right? A buy trade in the attached screenshot should be looking at the value of 2 but it's showing 1 here.

Files:
test9.mq5  31 kb
Untitled2.png  95 kb
Vladimir Karputov  
vertigo888 # :

Thanks - silly error on my part really.


I believe i've fixed this and then I removed all logic. The call is now



The script is just looking for the colours now (see code attached, please use in line with the other includes I attached before) -  Red  Buy (valc_tr[0] ==2) or Blue Sell (valc_tr[0] == 1) but the trades do not seem to match up to this logic. Is there anything else wrong or that does not look right? A buy trade in the attached screenshot should be looking at the value of 2 but it's showing 1 here.

It's hard for me to follow your thoughts - I don't understand at all what you are doing that you don't like? What is not working for you?

Remember - this is a technical forum: Your task is to describe the task in detail so that everyone can reproduce it.

Therefore, I insist that the example consists of a single file with very short logic.
Understand: no one wants to poke around in a thousand lines of code.