MarketInfo(NULL, MODE_TICKVALUE)
- You can use NULL in place of _Symbol only in those calls that the documentation specially says you can. iHigh does, MarketInfo does not. OrderSend does not.
- Don't use NULL (except for pointers where you explicitly check for it.) Use _Symbol and _Period, that is minimalist as possible and more efficient.
- Zero is the same as PERIOD_CURRENT which means _Period.
- No need for a function call with iHigh(NULL,0,s) just use the predefined arrays, i.e. High[].
Hi guys,
this script should close a part of the running trade just to cover a possible loss if the stoploss would be hit.
For example I bought EURUSD at 1.1600 and the stoploss is at 1.1550. Price rises to 1.1700. Now I want to sell exactly the amount of lots that the rest position is safe in case of price falling down to my stoploss at 1.1550.
I hope that makes sense.
Here is my code so far. Everything seems to be correct until the very last part of the code where I try to calculate the lots to close.