retesere20

---recycled----

Jul 12th, 2018
85
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. in Main:
  2. =======================
  3. private Series<bool> myBoolSeries; // Trigger Rule
  4. private List<double> myMetrics = new List<double>();
  5. private bool ok_to_trade = false;
  6. Dictionary<int, RotationMetric> _RotationMetrics = new Dictionary<int, RotationMetric>();
  7.  
  8.  
  9.  
  10. in State.Configure:
  11. =======================
  12. myBoolSeries = new Series<bool>(this);
  13. //TfSyncMasterSlave.DeleteSlaveFile(this);
  14.  
  15. for (int i = 0; i < BarsArray.Length; i++)
  16. {
  17. _RotationMetrics[i] = RotationMetric("ROCM", i);
  18. _RotationMetrics[i]._Close = this.Closes[i];
  19. }
  20.  
  21.  
  22. in OnBarUpdate:
  23. =======================
  24.  
  25.  
  26. // Experiment
  27. myMetrics.Clear();
  28.  
  29.  
  30. for (int i = 0; i < BarsArray.Length; i++)
  31. {
  32. myMetrics.Add(_RotationMetrics[i][0]);
  33. }
  34. myMetrics.Sort();
  35. if (to_trade < 0) myMetrics.Reverse();
  36.  
  37. ok_to_trade = ( to_trade < 0 && _RotationMetrics[0][0] <= myMetrics[to_trade - 1] ) ||
  38. ( to_trade > 0 && _RotationMetrics[0][0] >= myMetrics[to_trade - 1] );
RAW Paste Data