Login Page - Create Account

Support Board


Date/Time: Thu, 16 Jan 2025 03:16:37 +0000



Post From: Dollar Order Quantity

[2017-09-28 07:56:19]
Jagui1 - Posts: 14
This is an indicator to set order quantity to risk $200 if price goes 3*ATR(100) far away from current price. You can adapt it to your own needs.

// Automatically set the trade size in chart trader
SCSFExport scsf_LTradeSize(SCStudyInterfaceRef sc) {
  if (sc.SetDefaults) {
    sc.GraphName = "LTradeSize";
    sc.GraphRegion = 0;
    sc.FreeDLL = 0;
    sc.AutoLoop = 1;
    return;
  }  
  
  sc.ATR(sc.BaseDataIn, sc.Subgraph[0], 100, MOVAVGTYPE_SIMPLE);
  float ATR = sc.Subgraph[0][sc.Index];
  sc.TradeWindowOrderQuantity = (int) (200 / (3 * ATR));
}