Need updated code for PZ day trading EA

 

Hi I have an EA that based on the below PZ day trading indicator on mt4

My problem is the code that I have below that is driving the EA has the stoploss set to the bottom of box (if long) or top of the box (if short) plus a stoploss buffer of 5 pips. What I want to be able to do is have an option of having the stoploss of half way through the box, or better still have an option for the stop loss at the high/low of the preceding signal bar - shown below. And an option to have the stoploss set at the average price of the range bars (the bars in the boxes)


Also in code there is the below code that says:

 // true: If BUY is running and a new SELL Signal comes - then close the current order and start a new SELL order

// false: Keep running the original order until it hits full takeprofit/stoploss

extern bool stopOnNewSignal = false;


But this does not work as e.g. if long position activate then if sell signal comes in then it just stops the position out BUT does NOT then take a short position as it should...even if I change the code to 'true'


And finally it would be great instead of the rules of the taking profit system to have an option to pick a fixed take profit amount e.g. 50pips.


Any help would be greatly appreciated.

Full code below in next post:

 

Forum on trading, automated trading systems and testing trading strategies

When you post code please use the CODE button (Alt-S)!

Use the CODE button

Thank you.

Reason: