diff --git a/ASTPlayground/ASTPlayground.dproj b/ASTPlayground/ASTPlayground.dproj
index 675c478..001d1a5 100644
--- a/ASTPlayground/ASTPlayground.dproj
+++ b/ASTPlayground/ASTPlayground.dproj
@@ -4,7 +4,7 @@
20.3
FMX
True
- Debug
+ Release
Win64
ASTPlayground
2
diff --git a/ASTPlayground/MainForm.pas b/ASTPlayground/MainForm.pas
index c3ecbdb..3214a27 100644
--- a/ASTPlayground/MainForm.pas
+++ b/ASTPlayground/MainForm.pas
@@ -664,7 +664,7 @@ end;
procedure TForm1.OHLCButtonClick(Sender: TObject);
const
- numRecs = 100;
+ numRecs = 1000;
lookback = 50;
smaSlowLength = 20;
smaFastLength = 5;
@@ -827,8 +827,8 @@ begin
FGScope.SetValue('current_series', TAstValue.FromRecordSeries(series));
resultValue := callAst.Accept(visitor);
- Memo1.Lines.Add(Format('Tick %d/%d: Close = %.2f, Signal = %s', [i, numRecs, ohlcvRec.Close, resultValue.ToString]));
- Application.ProcessMessages;
+ // Memo1.Lines.Add(Format('Tick %d/%d: Close = %.2f, Signal = %s', [i, numRecs, ohlcvRec.Close, resultValue.ToString]));
+ // Application.ProcessMessages;
end;
end;
diff --git a/Src/AST/Myc.Ast.Evaluator.pas b/Src/AST/Myc.Ast.Evaluator.pas
index e8377e3..60b88ef 100644
--- a/Src/AST/Myc.Ast.Evaluator.pas
+++ b/Src/AST/Myc.Ast.Evaluator.pas
@@ -363,7 +363,6 @@ function TEvaluatorVisitor.VisitCreateSeries(const Node: ICreateSeriesNode): TAs
var
def: string;
begin
- // CORRECTED: Node.Definition is now a simple string.
def := Node.Definition.Trim;
// Based on the content, create a scalar or a record series.
@@ -421,13 +420,13 @@ begin
case baseValue.Kind of
avkSeries:
begin
- var series := baseValue.AsSeries.Value;
- if (index < 0) or (index >= series.Items.TotalCount) then
- raise EArgumentException
- .CreateFmt('Index %d is out of bounds for series with %d elements.', [index, series.Items.TotalCount]);
+ with baseValue.AsSeries.Value do
+ begin
+ if (index < 0) or (index >= Items.TotalCount) then
+ raise EArgumentException.CreateFmt('Index %d is out of bounds for series with %d elements.', [index, Items.TotalCount]);
- var scalarValue := series.Items[Integer(index)];
- Result := TAstValue.FromScalar(TScalar.Create(series.Kind, scalarValue));
+ Result := TAstValue.FromScalar(TScalar.Create(Kind, Items[Integer(index)]));
+ end;
end;
avkRecordSeries:
begin
@@ -464,15 +463,17 @@ begin
case baseValue.Kind of
avkSeries:
begin
- var series := baseValue.AsSeries.Value;
- if SameText(memberName, 'Count') then
- Result := TAstValue.FromScalar(TScalar.FromInt64(series.Items.Count))
- else if SameText(memberName, 'TotalCount') then
- Result := TAstValue.FromScalar(TScalar.FromInt64(series.Items.TotalCount))
- else if SameText(memberName, 'Kind') then
- Result := TAstValue.FromText(ScalarKindToString(series.Kind))
- else
- raise EArgumentException.CreateFmt('Member "%s" not found on TScalarSeries.', [memberName]);
+ with baseValue.AsSeries.Value do
+ begin
+ if SameText(memberName, 'Count') then
+ Result := TAstValue.FromScalar(TScalar.FromInt64(Items.Count))
+ else if SameText(memberName, 'TotalCount') then
+ Result := TAstValue.FromScalar(TScalar.FromInt64(Items.TotalCount))
+ else if SameText(memberName, 'Kind') then
+ Result := TAstValue.FromText(ScalarKindToString(Kind))
+ else
+ raise EArgumentException.CreateFmt('Member "%s" not found on TScalarSeries.', [memberName]);
+ end;
end;
avkRecordSeries: Result := TAstValue.FromMemberSeries(baseValue.AsRecordSeries.Value.CreateMemberSeries(memberName));
avkRecord: Result := TAstValue.FromScalar(baseValue.AsRecord.Items[memberName]);