Login Page - Create Account

Support Board


Date/Time: Wed, 27 Nov 2024 23:29:26 +0000



[Programming Help] - [Programming Help] convert this snippet of Python to ASCIL, will pay

View Count: 293

[2023-06-21 06:02:15]
ronvle - Posts: 4
hi all, appreciate if anyone could help to convert this snippet of Python to ascil. Below is my own ascil attempt code but could not achieve what I want, avgMaxATR == 0 always, willing to pay for your time also, thx

Python code:


df['tr0'] = abs(df["high"] - df["low"])
df['tr1'] = abs(df["high"] - df["close"].shift())
df['tr2'] = abs(df["low"] - df["close"].shift())
df['ATR'] = df[['tr0', 'tr1', 'tr2']].max(axis=1)
df['avgATR'] = df['ATR'].rolling(window=length).mean()

avgMaxATR = df['avgATR'].rolling(window=length).max().mean()

My ascil attempt:



SCFloatArray meanMaxATR;

SCFloatArray ATRHigh;

sc.ATR(sc.BaseDataIn, SG_ATR, 20, MOVAVGTYPE_SIMPLE);

ATRHigh[sc.Index] = sc.GetHighest(SG_ATR, 20);

sc.SimpleMovAvg(ATRHigh,meanMaxATR,20);



msg.Format("avgMaxATR=%f, highATR=%f, currentATR=%f",meanMaxATR[sc.Index],ATRHigh[sc.Index],SG_ATR[sc.Index]);

[2023-06-21 12:28:00]
ivory - Posts: 95
You could do this with a Spreadsheet
[2023-06-21 14:17:34]
ronvle - Posts: 4
thx, but I prefer to use ascil as I'm learning and will develop more with ascil

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

Login

Login Page - Create Account