snippet from my addon file:
namespace NinjaTrader.NinjaScript.Strategies
{
public partial class RemoteControl : Strategy
{
// This can be accessed from within another addon with MySharedMethodsAddonExample.SharedDouble
// or can be accessed from any script using NinjaTrader.NinjaScript.AddOns.MySharedMethods.SharedDouble
public static DateTime lastWriteAlive
{ get; set; }
public void BuyBid_rc(int ordersize, double Bid, string SignalName)
{
EnterLongLimit(ordersize,Bid, SignalName);
}
public void SellAsk_rc(int ordersize, double Ask, string SignalName)
{
EnterShortLimit(ordersize,Ask,SignalName);
}
}
private RemoteControl RC;
RC = new RemoteControl();
if (GRUp)
{
if (!(DrawObjects["DotUp" + CurrentBar] != null && DrawObjects["DotUp" + CurrentBar].GetType().Name == "Dot"))
Draw.Dot(this, "DotUp" + CurrentBar, true, 0, GetCurrentAsk(), Brushes.Blue);
Draw.VerticalLine(this, "Vline" + CurrentBar, 0, Brushes.LightBlue);
// EnterLong(0,orderSize,"G2Up");
RC.BuyBid_rc(orderSize,GetCurrentBid(),"G2Up");
}
if (GRDn)
{
if (!(DrawObjects["DotDn" + CurrentBar] != null && DrawObjects["DotDn" + CurrentBar].GetType().Name == "Dot"))
Draw.Dot(this, "DotDn" + CurrentBar, true, 0, GetCurrentBid(), Brushes.Red);
Draw.VerticalLine(this, "Vline" + CurrentBar, 0, Brushes.PeachPuff);
RC.SellAsk_rc(orderSize,GetCurrentAsk(),"G2Dn");
//EnterShort(0,orderSize,"G2Dn");
}
Comment