Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Good morning,
I have a problem, i dont know how to compile (write the exact word) in order to cancel my not filled order. The words in red give me compiling errors. Can someone give me an answer or any advice? Thx
My compilation for a short order:
{
if (ToTime(DateTime.Now) >= ToTime ( 10, 29, 57) && ToTime(DateTime.Now) <= ToTime ( 10, 29, 58))
{
EnterShortStopLimit( 1, GetCurrentBid() - 11 * TickSize, GetCurrentBid() - 5 * TickSize, "corto")
}
// Condition set 2 "if the price currentbid jump my limitprice and the order has not been filled, cancel the order"
if (ToTime(DateTime.Now) >= ToTime ( 10, 29, 59) && GetCurrentBid() < ShortStopLimit.LimitPrice && OrderStatus = not Working)
{
CancelOrder(ShortStopLimit);}
}
Can you help answer these questions from other members on NexusFi?
Hi again,
after using my programed strategy, the order didnt cancel when it was not filled. What am i missing? Thanx in advance.
My compiled strategy:
#region Using declarations
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Xml.Serialization;
using NinjaTrader.Cbi;
using NinjaTrader.Data;
using NinjaTrader.Indicator;
using NinjaTrader.Gui.Chart;
using NinjaTrader.Strategy;
#endregion
// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
/// <summary>
/// Enter the description of your strategy here
/// </summary>
[Description("Enter the description of your strategy here")]
public class GasBajadaCancel21 : Strategy
{
#region Variables
// Wizard generated variables
private int ordenes = 1; // Default setting for Ordenes
private int stop = 20; // Default setting for Stop
// User defined variables (add any user defined variables below)
private IOrder myOrder1;
#endregion
/// <summary>
/// This method is used to configure the strategy and is called once before any strategy method is called.
/// </summary>
protected override void Initialize()
{
SetProfitTarget("", CalculationMode.Ticks, 60);
SetTrailStop("", CalculationMode.Ticks, 20, false);
CalculateOnBarClose = false;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnMarketData(MarketDataEventArgs e)
{
// Condition set 1
if (ToTime(DateTime.Now) >= ToTime ( 16, 29, 57) && ToTime(DateTime.Now) <= ToTime ( 16, 29, 58))
{
myOrder1 = EnterShortStopLimit( 1, GetCurrentBid() - 31 * TickSize, GetCurrentBid() - 21 * TickSize, "corto");
DrawTextFixed("My text (fixed)" + CurrentBar, "Bajada", TextPosition.TopLeft);
}
// Condition set 2
if ((ToTime(DateTime.Now) >= ToTime ( 16, 29, 59)) && (GetCurrentBid() < myOrder1.LimitPrice) && (myOrder1.OrderState != OrderState.Filled))
{
CancelOrder(myOrder1);
}
}
#region Properties
[Description("")]
[GridCategory("Parameters")]
public int Ordenes
{
get { return ordenes; }
set { ordenes = Math.Max(1, value); }
}
[Description("")]
[GridCategory("Parameters")]
public int Stop
{
get { return stop; }
set { stop = Math.Max(1, value); }
}
#endregion
}
}