After profitable position pass n position
-
Hello Fxdreema. how can i set ea to after n consecutive profitable positions dont open n time position. for example after 2 consecutive profitable positions dont open next 3 positions. that is my diagram. https://fxdreema.com/shared/wvzEF0bad
thanks. -

-
@vish thank you. i going to try
-
where wil i put of diagram that part. after condition or after no trade or after buy-sell now block.
-
You have "No trade -> Condition" under "on Tick" and until new trade is created and the rules in Condition are true, these blocks will continue to pass over and over again. Then you have the counter, which will run multiple times very quickly and is useless. Not to mention that both of your conditions can be true over and over again multiple times in the same candle.
Also, you have this buy-sell-buy-sell configuration where the existence of trades controls the whole process. You want to somehow skip trades, which breaks the whole idea.
I made this - https://fxdreema.com/shared/zcOfXb3Pc
This has 2 variables. To control the buy-sell-buy-sell process I use one of the variables instead of Buy and Sell trades. The top part of this is almost the same as this example - https://fxdreema.com/demo/mt4-buy-sell-buy-sell-opposite-conditions - but instead of trades I'm working with the value of the variable, so the variable can be either "buy" or "sell".
For the main conditions I'm using MA, because it's easier for me to see what is going on in the chart. But I use the previous candles, because if I work on the current candles I notice multiple changes between "buy" and "sell" at the same candle. Those Draw arrow blocks draw some arrows, so you can see the final signals - white arrow for buy and red arrow for sell.
Then over this strategy I have the other strategy that involves counting consecutive profits and making trades. Even I am confused of what I did
But it seems to work. Here is what I got:
To add this EA in your projects, download it as .mq4 file and then import that file.
-
@fxdreema thank you very much for your working administrator. i was want to thank you for this site before. it is very helpful for poeople that is not programer like me. i will try ea.
-

-
hello. it is backtest grap. it is opening thosuands position in a bar. how can i fix it. what is my mistake. i copy your blocks for ea.
-

-
maybe my definition of variables is fault.
-
is there anybody to help ?
-
@cerrase I can look into it. Could you please share a copy of the current project, and try to simplify the problem as much as you can.
-
@roar hello roar. thanks for your interest . i want set ea when it win 2 consecutive profitable positions dont open next 3 signal . i want to pass 3 signals. because the system that i design losing consecutive 3 position after 2 consecutive profitable position.
-
@roar https://fxdreema.com/shared/wvzEF0bad it is share of project. it is a sample. please explain me how can we do right diagram and why if you can
-
@cerrase Ok. Firstly, about opening multiple trades per 1 bar - the code runs on every tick, so we should put a "once per bar" at the top of our logic, if we want max 1 trade per bar.
-
Secondly, it seems you just used the wrong counter block

Easy fix.
https://fxdreema.com/shared/8M4ghadOd
Edit: oops a mistake in "no trade (sell)", just connect it like the "no trade (buy)"Here's the files, in case you have the basic version. I recommend buying the subscription, though, 10 connections usually aren't enough for anything.
0_1552754595140_unnamed.ex4 -

-
@roar thank you for your working. there are some mistakes. the first it open position when candle open, i want to open when break to ma. i use breaks strategies not close on ma strategies. and second mistake is it is opening several positions i want 1 position.
-
@cerrase
The first block was using "candle low", I corrected it to "candle close"
https://fxdreema.com/shared/eKsf60nyb -
Perhaps you want the whole candle to be above / below the MA, then use this: https://fxdreema.com/shared/o7HGBJbD