Me and my friend had a bet that a strategy he heard about does not not work. I have code logic for my EA in Python and It does not work. But my friend claim I code it wrong said it should be built in MT4 because they is the FX standards.
I can provide the source code in Python. The EA is quite simple. In each tick it check each currency and decides check if the current order is filled if the order is filled the EA submits a new Stop Order for the currency.
I would like the source code of the final product for me to compile and execute
Here is the logic of the EA. There are no indicators. The logic is a bit complex, but the math is very simple. Basically it enters a trade. If the trade goes again you it enters a short position. Keeps entering addtional long and short positions until the trade either hits the stop loss or profit target. The stop loss for the buy trade is the profit target for the sell trade. Also the stop loss for the sell trade is the profit target for the buy trade. So this means when a stop loss or profit target is hit all the trades close together.
What make it a bit more complex is he wants to test the stratgy with a bullish and bearish strategies and want to test for multiple currencies at one.
The solution will need the following inputs.
Tickers:
Pip Units:
Lot Units:
Directions:
Bullish Magic Numbers:
Bearish Magic Numbers:
Trade Units:
Take Profit Ratio
Stop Loss Ratio
During the initialization these inputs will need to be converted in to arrays.
There will need to be a loop on the OnTick event where it loops through each ticker. With in the loop it will do the following
Get the Bullish strategy Magic Number for the current Ticker in the loop from the array
If Has Open Positions
If No Open Positions and Has Unfilled Orders
If there are no open positions and has unfilled order
If there are no open positions and no unfilled orders.
If there are no unfilled orders will
Each Order that is executed will be a Stop Order with a Ticker, Stop Price, Quantity, Take Profit, Stop Loss, Magic Number.
where
The logic above is for a bullish strategy and want to repeat for a bearish strategy but in reverse.
Also would like on the chart white circle and squares for buy and sell for open bullish strategy positions with blue lines connecting to the close point. Fore the bearish strategy would like red line connecting to the target. But what ever you think looks good.
The strategy should be quite simple there is not complex math. However the Inputs have to be loaded into arrays and the arrays need to be accessed to get the values. But that is about it.