Lot size decrease
-
Greetings,
As you will notice, my EA trades as per candle, then any open positions, it will close after a bar or two. I want to edit my EA to where the first two positions will open at lot size of 1, then the next two will be 0.9, then the next two will be 0.8, until it reaches 0.01. then it will reset per candle opening.
Below is my shared project:
https://fxdreema.com/shared/h3Gnmflbe -
@ramimoujaes How is that decreasing scale move from 0.8 to 0.01?
-
Greetings @l-andorrà,
I am sorry. What I mean is that I only want every two positions opened to start with a lot size of 1, then every two positions closed, decrease the lot size by 0.1. Until when reached a lot size of 0.1, then decrease lot size to 0.01.
-
@ramimoujaes Just to be sure. You mean:
Trade 1 with 1.0
Trade 2 with 1.0
Trade 3 with 0.9
Trade 4 with 0.9
Trade 5 with 0.8
Trade 6 with 0.8Is that correct?
-
Greetings @l-andorrà
Yes, but kindly note that when the 2 positions, with lot size of 0.1 are closed, the next lot sizes is going to be 0.01.
Kindly note that it resets per candle. (Which means the next candle, First two opening position if conditions are met, will be 1.0, then the next two will be 0.9, and the procedure repeats itself)
-
@ramimoujaes Is this sequence changed if any of the trades is successful or not? I mean, is this sequence conditioned by the trade's result?
-
Greetings @l-andorrà ,
No it isnt
-
@ramimoujaes This is not a trivial project to do. You will need at least four variables. One of them to count how many consecutive trades were closed. Another one to subtract the specified amount of lot size after the second trade of each step. Another one to identify the aplicable lot size to each new trade and the last one to 'move' from 0.1 to 0.01.
Are you good at creating and using variables?

-
Greetings @l-andorrà ,
No I am not good. If you can tell me spot on where to click and what to type in, that would be great
-
@ramimoujaes Let me be honest, my previous post was a polite way to ask you if you really need that feature for your EA right now. Maybe you should start with all the others and then let this one aside initially.

-
Greetings @l-andorrà,
What do you mean all the others.
I insist on adding this feature. So, I expect your next reply to teach me how to add this feature in details, because I do not know how to create and use variables
-
Greetings @line @roar @AlphaOmega
Do you think you can help me creating the variables please?
-
@ramimoujaes My friend you should ask @roar, he is the magician with variables... if it is not to difficult there is other members that can help you... I am also like you, at the start of my learning journey...
-
Greetings @roar ,
Apparently, you're the man. And I need you help now more than ever
-
@ramimoujaes hi!
You didnt mention about buy/sell separation, does the calculation take that into account. So I have to assume.
https://fxdreema.com/shared/NYjuilPKd
Here is my thoughts, its not exactly as in your project, but I hope you get something out of it.
Download the .mq5 and import it back again to your builder, then you see all the variables and such.There's lots of "advanced" tricks in the example - I'll leave you to chew on it for a couple days, before answering the follow-ups

-
Greetings @roar ,
A thousand apologies for disturbing you. I just wanted to thank you for your earliest response and support.
Just to give you a brief on my project. I am simply trying to create an EA on mt5, where positions are open based on the RSI indicator (Overbought/Oversold). Essentially there are no stop-loss, there is a take-profit (which is very minimal). Opened positions are closed after a candle or two has passed by.
I am positive that the first couple trades are going to take minimal profit, at the same time I am positive the last trade opened, is going to be a loss. Which is why I would like the EA to open the first couple positions with lot size of 1.0 (must be adjustable) and as more positions have been closed, the lot size will decrease. For example, if the first position started at lot 1.0, then every 2 positions (for example, must be adjustable) lot size will decrease by 0.1. However, when EA closes the two positions, both with lot size of 0.1, then the next positions taken will be 0.01 (because you can not take positions a 0 lot position (0.1-0.1=0) until a new candle/bar is opened.
When the new candle is opened, and no position are opened, then restart. What do I mean by restart. I mean the positions that will be opened on a new candle when conditions are met, shall start over starting with lot size of 1.0, then every two positions closed, decrease lot size by 0.1, until lot size reaches 0.01. And the process goes on and on.
I just wanted to explain it to you in detail.
I would like to tell you that I am not a programmer, and I am really new to the whole mt5 forex trading world. As much as I read the articles presented by fxdreema, I still have blank mind unfortunately. So I kindly request from you, at your earliest convenience to baby step me, as in tell me exactly what should I do in fxdreema (what to type in, which blocks to connect) in order to complete this project.
My struggle is how to start the lot size by 1.0 (adjustable) when conditions are met, and then every 2 positions closed (adjustable), decrease the lot size by 0.1 (adjustable) until the EA reaches lot size 0.01. Then on new candle restart lot size, start with lot size of one and decrease as positions are taken.
I kindly request help from the one and only @roar with my struggle.
Shared Project: https://fxdreema.com/shared/ntRhJgAUc
Sincerely
Rami