How to validate freemargin before i send the order?

Back to topics list To post a new topic, please log in or register
avatar
273
sheriffonline 2015.10.22 19: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())))
avatar
13004
WHRoeder 2015.10.22 22: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
Back to topics list  

To add comments, please log in or register