Login Page - Create Account

Support Board


Date/Time: Sun, 24 Nov 2024 10:40:43 +0000



Post From: TickValue & PointValue for Instrument

[2024-06-09 19:20:15]
User567781 - Posts: 5
Here is how I approached the contract values in case anyone else needs some help:

//prototypes
float GetTickSize(SCStudyGraphRef sc, SCString attachedInstrument);
float ConvertTicksToDollars(SCStudyGraphRef sc, int ticks, int contracts);
float GetTickValue(SCStudyGraphRef sc, SCString attachedInstrument);
float GetTicksPerPoint(SCStudyGraphRef sc, float tickSize);

float GetTickSize(SCStudyGraphRef sc, SCString attachedInstrument)
{
  float tickSize = sc.TickSize;

  return (tickSize);
}
float ConvertTicksToDollars(SCStudyGraphRef sc, int ticks, int contracts)
{
  float dollarValue = 0;

  if (ticks > 0 && contracts > 0)
  {
    float tickValue = sc.CurrencyValuePerTick;

    float tickSize = sc.TickSize;
    
    dollarValue = tickValue * ticks * contracts;
  }

  return dollarValue;
}
float GetTickValue(SCStudyGraphRef sc, SCString attachedInstrument)
{
  float tickValue = 0;
  //float tickValue = instrument.MasterInstrument.PointValue * CustomChartBarInterface.TickSize;
  //PointValue = currency val of 1 point move $20 for nq, $2 for mnq
  //ticksize = 0.25 4 per point
  //mnq 1 tick $0.50
  //nq 1 tick $5.00
  //.25*20 = $5

  tickValue = sc.CurrencyValuePerTick;

  return tickValue;
}
float GetTicksPerPoint(SCStudyGraphRef sc, float tickSize)
{
  float tickPoint = 1;

  if (tickSize < 1)
  {
    tickPoint = (float)(1.0 / tickSize);
  }

  return (tickPoint);
}