Need help with code..

 
Hi, Can anyone help me with a little script that I got on my mind.. I"m new to MQL but I found something that can promise me constant profit of 4 pips per week, and I really need to transfer it to code.

I want the script to run on weekly period.
When a new candlestick is created, the program checks what was the previous candlestick [bullish/bearish].
in case of bullish:
send BUY order with a take profit of 4 pips above the current price.
in case of bearish:
send SELL order with a take profit of 4 pips below the current price.

Iv'e opened an account of 1:500 Leverage. So I need te script also calculate the maximum Lots that is allowed.

For example:

I Start with $400, Maximum Lots is 2.0 so 4 pips are $160
Next month, I got $560, and Max Lots is 2.8 (by calculations) but it will use only 2.0 so I got profit of $160
Next month, I got $720, and Max Lots is 3.6 (by calculations) but it will use only 3.0 so I got profit of $240
....
....
....
Month by month the Lots will get higher in an exponentially way, And Iv'e calculated that in about 25 month there will be more than a $1,000,000 in my account.

The idea is that new candlestick that is created(on weekly!) keeps the trend of the previus one for at least a couple of pips that is good enough for my purpose.
so I want also to run a backtest to see how many times my script gets a 20 pips loss (that kind of loss will get you lose all your money no matter how much money this script earned ).High Lots need a safe plan, So It is only a 4 pips profit per week (2 for me,and 2 for commission), I don't think it will ever fail.


Thanks!!!
Reason: