Trabajo finalizado
Tarea técnica
See the attached zip file for description of the Expert advisor.
If you have any questions please let me know!
--------------
Semi-auto Expert advisor
I am looking to create an expert advisor that will enter the first trades based on manual entry and handle the trading sequence until the end.
As shown in the picture below you have two horizontal lines I have placed on the chart. One horizontal line above the price and one line below the price.
The EA will place orders when I click a button on the chart that should say "trade".
In this case, the EA will do the following:
-
It will place a buy-stop order at the horizontal line above the price. The Stop loss will be the horizontal line below the price. Target will be based on risk to reward in the settings.
-
It will place a sell-stop order at the horizontal line below the price and SL will be the horizontal line above the price. Target will be based on risk to reward in the settings.
-
These orders will be OCO (one order cancels the other). So, if the Buy order is hit then the sell order will be deleted.
-
If the buy order is hit, then the EA will close the old sell order and place a new sell order in the same place with a different target and higher lot size. This is known as the recovery trade. The target and lot size for the recovery trade is determined in the settings.
-
If the recovery trade is activated this is also a stop loss for the buy order (first trade).
-
At this point, we only have one open trade (recovery trade)
SETTINGS
Lot mode: Risk balance or fixed lot. Risk balance will used lots 1 and lots 2 to calculate the lot size based on percent risk of the account. Fixed lot is fixed lot.
Lots1 = If risk balanced is enabled then this number is the % risk of balance. The EA will calculate the lot size based on this. If fix lot is enabled, then this number is the lot size. This seDng is for the first two orders in the beginning.
Lots2 = Same as above, but this seDng is for the recovery trade.
TP1 = This is the risk to reward for the first to orders. If it says 0,45 then the TP is 0,45 to 1. TP2: This is the risk to reward for the recovery trade.
Max volume: If I enter 50 in this seDng, I am telling the EA that the max lot for one trade is 50 lot set by the broker. If the EA needs to place a trade with 100 lot based on the other seDngs the EA will understand that it needs to place two trades of 50 lot because 1 trade with 100 lot would trigger the error “invalid volume”
BUTTONS
When I drag the EA to the chart it will show two buPons:
TRADE: When I press this buPon the EA will look for the horizontal lines and place the first two orders. It will also handle the trading procedure unRl TP on first order or TP/SL on the recovery order.
CLOSE ALL ORDERS: If This buPon is pressed then all open trades and orders will be closed, and EA stop trading.