put a pending order on object after x pips
-
Hey guys, so yesterday i tried to loop my Grid system and let it refill the levels. So i came up with an idea to create for each created order an object line, on which i can put the pending orders. What i need would be a condition to only let it put the orders on it after it has moved x pips from the object. So it would loop more properly. I'm out of inspiration on how i could implement this... This is my project: as you can see it opens multiple pending orders on level 3 and 2 and i need a way to improve it.... As always every help is appreciated!!

-
This will refill the levels without using any objects (they are always a mess):
https://fxdreema.com/shared/xtZo20GheHow it works:
- first establish firstlevel variable, this is the lowest level in the grid
- then check if price has moved below firstlevel and there are less than maximum number of orders
- then make a loop that goes through every grid level
- if the EA finds an order at the grid level, it moves on to next level
- if an order is missing from a level, new pending order is placed there
This is just a template that uses fixed firstlevel parameter, you will need to modify it to fit your system.
Constants and variables:


-
@roar said in put a pending order on object after x pips:
This is just a template that uses fixed firstlevel parameter, you will need to modify it to fit your system.
wow! Thanks for this block order and your time!! I would have never come up with this structure, i will analyse it now and try to understand how i can adapt it
-
@fabien-s Great! It may be a bit over-complicated, just made it in a fly..
Note that I use adjust-field a lot, and I convert the raw values to pips:

If there's any particular section that needs more explanation, just ask!
-
@roar This way of scanning the variables is awesome! never thought of using variables this way with the adjust field.

I have one question:
Why do we need this block when firstlevel starts with 0, theoretically one could also leave the block and directly connect modify variable to the blocks above? hmmm
And i tested the structure using this project https://fxdreema.com/shared/PKKMSOM4b It all worked fine looped worked but somehow the grid got placed upwards from the inital grid.

Overall i think i know what i have to change for it to work with my project, very grateful for the help
-
Glad it works for you!
@fabien-s said in put a pending order on object after x pips:
Why do we need this block when firstlevel starts with 0
This is just because I wanted a simple example with fixed grid.
The EA checks if firstlevel has ever been modified, if not, it modifies it 1 time and then always uses the same value for ever after.A proper EA will need some new way to calculate the firstlevel as price moves on.