Login Page - Create Account

Support Board


Date/Time: Tue, 26 Nov 2024 07:35:41 +0000



Post From: ACSIL for automating price expansion tool with float array from study

[2023-12-30 06:36:48]
mv3trader5 - Posts: 5
I'm trying to build a custom study that draws the custom study from the high and low as identified by the High/Low for Time Period study. I'm getting stuck at how to reference the high and low from the float array to for the Beginvalue and endvalue of the price expansion tool. I'm assuming "BeginValue and EndValue is the Anchor points for the expansion tool. Please point me in the right direction if what I'm trying to achieve is possible, thanks.

Here's the error I'm receiving when compiling:
137:20: error: cannot convert 'SCFloatArray' {aka 'c_ArrayWrapper<float>'} to 'float' in initialization

One of the ways I've attempted:

//log
  SCString msg;
  
  //inputs
  SCInputRef i_RangeHigh = sc.Input[0];
  SCInputRef i_RangeLow = sc.Input[1];
  
  // Section 1 - Set the configuration variables and defaults
  if (sc.SetDefaults)
  {
    sc.GraphName = "Auto Power Range Levels";
    sc.GraphRegion = 0;

    sc.AutoLoop = 1;
    
    i_RangeHigh.Name = "High for Time Period Reference";
    i_RangeHigh.SetChartStudySubgraphValues(1,1, 0);
    
    i_RangeLow.Name = "Low for Time Period Reference";
    i_RangeLow.SetChartStudySubgraphValues(1,1, 0);
    
    
    return;
  }
  
  SCFloatArray powerRange;
  
  sc.GetStudyArrayFromChartUsingID(i_RangeHigh.GetChartStudySubgraphValues(), powerRange);
  sc.GetStudyArrayFromChartUsingID(i_RangeLow.GetChartStudySubgraphValues(), powerRange);

  
  //Draw Price Expansion (Fib Levels) tool
  int& r_LineNumber = sc.GetPersistentInt(1);
  
  if (sc.IsFullRecalculation)
  {
    s_UseTool Tool;
    //Tool.Clear();
    Tool.ChartNumber = sc.ChartNumber;
    Tool.DrawingType = DRAWING_PRICE_EXPANSION;
    
    if (r_LineNumber != 0)
      Tool.LineNumber = r_LineNumber;
    
    //Plotting Price Expansion Tool
    float BarIndex = powerRange;
    Tool.BeginValue = sc.High[BarIndex];
    Tool.EndValue = sc.Low[BarIndex];
    Tool.AddMethod = UTAM_ADD_OR_ADJUST;
    
    
    Tool.ShowPrice = 1;
    Tool.ShowPercent = 0;
      
  }

  
  
}