Is this ok?
-
Just put together my first EA and wondering if this should work?
https://fxdreema.com/shared/va8vDDqFc
I know I don't have any close functions, just did this with <10 connections so I could export it and test prior to getting a subscription.The logic is:
If Indicator > Open and/or Indicator > Close on current bar then Buy (then inverse for Sells)
I've got the two 'Once per bar' so that there can be two trades opened per bar, one for Open and one for Close.
I'm expecting this will open multiple trades in both directions.
The close condition once applied would be to close all trades when 'x' profit reached.I get a lot of errors in the Journal which I have no idea what they're meaning, and for some reason it's got a Variable in MT4 inp10_VolumePercent that I have no idea where it's come from...?

thanks guys

-
The "once per bar" works only at the beginning of each bar, so the price is essentially the open price. That's why its not very beneficial to check both open and close prices at the first tick, because they are the same.
I would use this logic:

In English: once per bar we check the current candle open (current candle = id 0) and compare it to the indicator (blocks 5 and 6).
If that condition is true -> open trade- Note that block 6 comes only when 5 is false, because they BOTH can never be true!
Then check close price, and not current candle close but LAST candle close (id 1) (blocks 7 &

Note that this is somewhat silly logic because 2 of the 4 conditions must always be true - the bot trades 2 times every bar!
-
Hi @roar ,
Thanks for your help, I realise it seems a bit nonsensical but the idea was to accumulate as many valid trades as possible, without going completely bananaz and opening one for every tick, so two/bar seemed reasonable...
I'd forgotten that 'Close 1 = Open 0' and it was only after I ran a visual backtest and saw it opening two trades on Open I had that 'duhhh' moment, but no biggie it's doing near enough to what I was thinking.I had a go rebuilding it from scratch and it no longer had the inp10_VolumePercent value in MT4 and it then traded as I expected instead of sitting there doing nothing. So I think that was the root cause my confusion.
I think it might be some sort of fxDreema UI bug where I clicked next to a value somewhere that has no tick box and it was added as a variable anyway. I've been using FF so I'll switch to Chrome for working with this which will hopefully avoid weirdness like that.So should I just ignore all those errors?
-
"inp10_..." refers to block #10 - you dont even have block #10, so thats strange indeed.
I am not sure about that TestGenerator error, it seems to be warning about your trade size (as you trade every candle and never close)
-
Hi @roar
I'd been thinking about the way you daisy-chained those Condition blocks, do you know if they both execute on the same tick, or does the false output on the first only become active on the following tick?Also after thinking about my logic it was pretty stoopid. xD
I'm doubling trades when I could just increase exposure, or even better diversify!I found I was able to cut it right back to just four blocks, Once per bar > Condition > Buy / Sell.
It does mean that one side of the condition also hits on an == status but made it extremely simple! -
They all execute on the same tick, no matter if there was 1000 horizontally connected blocks

-
@drayzen said in Is this ok?:
I get a lot of errors in the Journal which I have no idea what they're meaning, and for some reason it's got a Variable in MT4 inp10_VolumePercent that I have no idea where it's come from...?
I only have an idea what these errors mean. They are not because of the EA, but because of the ticks data. You probably know that MT4 has data for each timeframe - M1, M5, M15 and so on... When you are testing on H1 let's say, data from lower timeframes is used. But sometimes we have periods of missing data and I think the problem is because of this. It could be something else, I don't know how exactly the backtest works, but the problem is for sure because of the quality of the ticks data.