Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- in Main:
- =======================
- private Series<bool> myBoolSeries; // Trigger Rule
- private List<double> myMetrics = new List<double>();
- private bool ok_to_trade = false;
- Dictionary<int, RotationMetric> _RotationMetrics = new Dictionary<int, RotationMetric>();
- in State.Configure:
- =======================
- myBoolSeries = new Series<bool>(this);
- //TfSyncMasterSlave.DeleteSlaveFile(this);
- for (int i = 0; i < BarsArray.Length; i++)
- {
- _RotationMetrics[i] = RotationMetric("ROCM", i);
- _RotationMetrics[i]._Close = this.Closes[i];
- }
- in OnBarUpdate:
- =======================
- // Experiment
- myMetrics.Clear();
- for (int i = 0; i < BarsArray.Length; i++)
- {
- myMetrics.Add(_RotationMetrics[i][0]);
- }
- myMetrics.Sort();
- if (to_trade < 0) myMetrics.Reverse();
- ok_to_trade = ( to_trade < 0 && _RotationMetrics[0][0] <= myMetrics[to_trade - 1] ) ||
- ( to_trade > 0 && _RotationMetrics[0][0] >= myMetrics[to_trade - 1] );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement