Login Page - Create Account

Support Board


Date/Time: Wed, 27 Nov 2024 23:32:00 +0000



[Programming Help] - Recalculating sc.SimpleMovAvg() within manual loop.

View Count: 296

[2023-06-20 09:54:43]
User92573 - Posts: 530
Dear Support Board

Any help or direction gratefully received.

I'm simply trying to recalculate the sc.SimpleMovAvg() array following an event/change in data.



int Current_Index = sc.Index;

On Event

{
Input_SMA_Length.SetInt(10)

// Now iterate through the sc.SimpleMovAvg() array an update the data/values

for (int i_Index = 0; i_Index <= Current_Index; ++i_Index)
{

sc.SimpleMovAvg(sc.BaseData[SC_LAST][i_Index], Subgraph_SimpleMA[i_Index], Input_SMA_Length.GetInt());

}


}


The rror message is "cannot convert argument 1 from 'float' to 'SCFloatArrayRef'"

As I'm learning ACSIL this has me a little stumped so any help or direction appreciated.

Many thanks.
[2023-06-20 11:03:34]
User431178 - Posts: 544
First and second arguments are SCFloatArrayRef, you are passing in the float value at i_Index for each.
Indexing is controlled by the third argument, as function requires 4 arguments with manual looping.


SCFloatArrayRef SimpleMovAvg(SCFloatArrayRef FloatArrayIn, SCFloatArrayRef FloatArrayOut, int Index, int Length);




int Current_Index = sc.Index;

On Event

{
Input_SMA_Length.SetInt(10)

// Now iterate through the sc.SimpleMovAvg() array an update the data/values

for (int i_Index = 0; i_Index <= Current_Index; ++i_Index)
{
sc.SimpleMovAvg(sc.BaseData[SC_LAST], Subgraph_SimpleMA, i_Index, Input_SMA_Length.GetInt());
}
}

[2023-06-20 14:51:19]
User92573 - Posts: 530
User431178

Thank you so much.
I'd have struggled to find that.
Many thanks

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account