Help for coding a function

 

Hi mates:

I have a function want to add into an EA, I think maybe genius MQL

programmer in this forum can help me,thanks in advance!

The detail as below:

1.I already have the check function for open and close orders,let me call them OpenCheck() and CloseCheck().Let us call the new function I want to write as the name OrderCheck().

2.Let us take the pair USDJPY and the BUY side as example, if their is no BUY orders opened.OrderCheck() will run the OpenCheck().If there is one open order(opened BUY at 120.00).OrderCheck() will contiune run the OpenCheck(), but only place the second BUY order under the price 119.50.And so the third will be under 119.00 if price still go down.Every buy order should have at least 50 pips distance.The MAX number of BUY orders should be 10. What I mean is place the BUY order as the rule of OpenCheck() and the Rule of 50 pips distance at least.

For example,maybe the second BUY Order will be opened at 119.40, then the third BUY order should at least be opened at 118.90 or more lower, this is the right work mode.

3.When the BUY Order numbers reached 10, then the OrderCheck() only run CloseCheck() function.

4.The same work principle for sell orders.OpenCheck() and CloseCheck() can handle both buy and sell orders.

 

And each time we have loss, we add another position and on 10-th level we have -2250 pips And after that we switch to "watching mode" - we watch how with every pip we lose 50 more pips!

 
Shinigami:
And each time we have loss, we add another position and on 10-th level we have -2250 pips And after that we switch to "watching mode" - we watch how with every pip we lose 50 more pips!

Shinigami, how your answer is helping Imx ????

Your superiority sentiment makes you blind most of the time.

Imx, you have just invented again the grid trading.

Many people have already do a lot of work regarding this kind of strategy. Take a look at "MakeGrid" or even some 10.3 with lot multipier = 1. It's also knowed as "Price Averaging".

Such a strategy may be very profitable if you have a big account, an heart very strong and a minimalistical MM...

It's a strategy for bad traders, as I am, who aren't able to find the good entries/directions, but it's possible to turn 10k to 200k in one year using it.

Considere this sample :

a good trader knows he is very good, he opens a 15 lots Buy USDCAD @1.0720 no SL no TP.

Now he has a floating loss of 4500 pips (-43000$).

a bad trader knows he is bad, so he opens a 1 lot Buy USDCAD @1.0720 and 1 lot every 50 pips lower.

He has now a 6 lots position and a floating loss of 900 pips (-8600$)

That's why I prefer to be bad...