Download MetaTrader 5
To add comments, please log in or register
Use the Pocket to paste your content. It is convenient!
Sherif Hasan
7221
Sherif Hasan 2015.10.22 17:27 

Currently i use the following code to check freemargin before send the order

if(AccountFreeMarginCheck(Symbol(),OP_BUY,Lots)<=0 return;  

But some brokers has StopoutLevel, so how to validate for the situaltion?

tried following code. but not validating.

if (((AccountStopoutMode() == 1)
&& (AccountFreeMarginCheck(Symbol(), OP_BUY, Lots) > AccountStopoutLevel()))
|| ((AccountStopoutMode() == 0)
&& (((AccountFreeMarginCheck(Symbol(), OP_BUY, Lots)/AccountEquity()) * 100) > AccountStopoutLevel())))
whroeder1
13597
whroeder1 2015.10.22 20:07  
  1. You place the stop where it needs to be - where the reason for the trade is no longer valid. E.g. trading a support bounce the stop goes below the support.
  2. Account Balance * percent = RISK = |OrderOpenPrice - OrderStopLoss| * OrderLots * DeltaPerlot (Note OOP-OSL includes the SPREAD)
  3. Do NOT use TickValue by itself - DeltaPerlot
  4. You must normalize lots properly and check against min and max.
  5. You must also check FreeMargin to avoid stop out
/
To add comments, please log in or register