Profile Picture

FX and Futures Anomaly

Posted By ywlee 4 Years Ago
Posted Tuesday October 22 2013
Hi Daniel

I ran the following code with the futures (Cocoa) and fx (EURUSD) (see attached files).

The futures had results but the fx didn't return anything although graphically, there will be bars that trigger results for both.

Does that fact that fx uses "mid" rather than "close" affect the results?

Public Class MySymbolScript
Inherits MySymbolScriptBase

Private sma50 As New SMA(50)
Private sma100 As New SMA(100)
Private ATR As New AverageTrueRange(14)
Private highest55 As New Highest(55)

Public Overloads Overrides Sub Startup()
' Perform initialization here

End Sub

Public Overloads Overrides Sub NewBar()
' Put your trading code here

If lastclose.Current >= highest55.Current AndAlso sma50.LookBack(0) > sma100.LookBack(0) Then

OpenPosition(PositionType.Long, OrderType.MarketOnOpen)

End If

End Sub

Public Overloads Overrides Sub OrderFilled(ByVal position As Position, ByVal trade As Trade)
' This method is called when an order is filled
' Check if this is the entry trade for a position

End Sub

   Public Overloads Overrides Sub OrderCancelled(ByVal position As Position, ByVal order As Order, ByVal information As String)
      ' This method is called when an order is cancelled or rejected
If Not order.CancelPending Then
OutputWarning("Unexpected order cancel: " & order.ToString() & " " & information)
End If
   End Sub
End Class

Cocoa.txt (201 views, 189.00 KB)
EURUSD.txt (227 views, 16.00 KB)

Similar Topics

Reading This Topic

2005-2017 © RightEdge Systems