Add series, SMA, and WMA indicators
Introduce new indicators for Simple Moving Average (SMA) and Weighted Moving Average (WMA), along with their Hull Moving Average (HMA) derivative. Also refactors series implementation to use `RefCell` for interior mutability and adds `SeriesMember` trait for better dynamic series access. Updates `soa_series.myc` example to reflect new series creation and push syntax.
This commit is contained in:
@@ -89,16 +89,16 @@ impl FunctionCompiler {
|
||||
match self.kind {
|
||||
ScopeKind::Root => {
|
||||
let mut globals_map = globals.borrow_mut();
|
||||
if globals_map.contains_key(name) {
|
||||
return Err(format!(
|
||||
"Global variable '{}' is already defined.",
|
||||
name.name
|
||||
));
|
||||
if let Some((idx, existing_id)) = globals_map.get(name) {
|
||||
if *existing_id != identity {
|
||||
return Err(format!("Variable '{}' is already defined in global scope.", name.name));
|
||||
}
|
||||
return Ok(Address::Global(*idx));
|
||||
}
|
||||
let idx = GlobalIdx(globals_map.len() as u32);
|
||||
globals_map.insert(name.clone(), (idx, identity));
|
||||
Ok(Address::Global(idx))
|
||||
}
|
||||
let idx = globals_map.len() as u32;
|
||||
globals_map.insert(name.clone(), (GlobalIdx(idx), identity));
|
||||
Ok(Address::Global(GlobalIdx(idx)))
|
||||
}
|
||||
ScopeKind::Local => {
|
||||
let slot = self.scope.define(name, identity)?;
|
||||
Ok(Address::Local(slot))
|
||||
|
||||
Reference in New Issue
Block a user