1 #region Using statements 2 using System; 3 using System.Drawing; 4 using System.Collections.Generic; 5 using RightEdge.Common; 6 using RightEdge.Common.ChartObjects; 7 using RightEdge.Indicators; 8 using RightEdgeFSharpLib; 9 #endregion 10 11 #region System class 12 public class MySystem : MySystemBase 13 { 14 public override void Startup() 15 { 16 // Perform initialization or set system wide options here 17 18 } 19 } 20 #endregion 21 22 public class MySymbolScript : MySymbolScriptBase 23 { 24 public override void Startup() 25 { 26 // Perform initialization here. 27 this.Indicators["Highest"].ChartSettings.ShowInChart = true; 28 this.Indicators["Lowest"].ChartSettings.ShowInChart = true; 29 30 } 31 32 33 34 public override void NewBar() 35 { 36 // Put your trading code here 37 38 // if (this.Close.Current >= this.Indicators["Highest"].Current && this.OpenPositions.Count == 0) 39 // { 40 // PositionSettings ps = new PositionSettings(); 41 // ps.Description = "Buy"; 42 // ps.OrderType = OrderType.Market; 43 // ps.PositionType = PositionType.Long; 44 // ps.StopLoss = this.Indicators["Lowest"].Current; 45 // ps.StopLossType = TargetPriceType.Price; 46 // ps.TrailingStopType = TargetPriceType.Percentage; 47 // ps.TrailingStop = 0.08; 48 // Position pos = this.OpenPosition(ps); 49 // PositionManager.SetTrailingStop(pos.ID, 0.05, TargetPriceType.Percentage); 50 // 51 // } 52 53 //Tested with AAPL and MSFT 54 //The above code is equivalent to this call 55 56 TestModule.NewBarAction(this as SymbolScriptBase, PositionManager); 57 } 58 59 60 61 public override void OrderFilled(Position position, Trade trade) 62 { 63 // This method is called when an order is filled 64 65 66 67 } 68 69 public override void OrderCancelled(Position position, Order order, string information) 70 { 71 // This method is called when an order is cancelled or rejected 72 position.CloseAtMarket(); 73 } 74 } 75