• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Does not enter the trade

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • NinjaTrader_Bertrand
    replied
    Thanks, I don't see an issue per se - with a simple test entry rule for market order like

    // Condition set 1
    if (UpandDowns()[0] >= 1)
    {
    EnterLong(DefaultQuantity, "");
    }

    ...I see it entering trades as expected.

    Leave a comment:


  • andrew-aut1
    replied
    entry condition: plot hitting the value of 1 for going long. Idea is that after a fall in at the first day succeeded by two rises of the two following days will give me the opportunity to get in the market = value 1: My code is as follows : PS: don't get confused: the script has been modified was a script for Keltner Channels in the beginning; thus I couldn't get rid off the variables period and offset Multiplier and they are not of interest.

    Many thx!



    public class UpandDowns : Indicator
    {
    #region Variables
    private int period = 10;
    private double offsetMultiplier = 1.5;
    private DataSeries diff;

    private int timeframe = 390;
    private DataSeries myDataSeries; // Define a DataSeries variable
    #endregion

    /// <summary>
    /// This method is used to configure the indicator and is called once before any bar data is loaded.
    /// </summary>
    protected override void Initialize()
    {
    Add(PeriodType.Minute, timeframe);
    //myDataSeries = new DataSeries(this, MaximumBarsLookBack.Infinite);

    Add(new Plot(Color.Blue, "Marker"));
    //Add(new Plot(Color.Red,PlotStyle.Dot, "Marker2"));
    diff = new DataSeries(this);

    Overlay = false;
    }

    /// <summary>
    /// Called on each bar update event (incoming tick).
    /// </summary>
    protected override void OnBarUpdate()
    {
    /* Only need to sync DataSeries objects once. We couldn't do this sync in the Initialize() method because we
    cannot access the BarsArray property there. */
    if (diff == null && BarsInProgress == 1)
    {
    /* Syncs another DataSeries object to the secondary bar object.
    We use an arbitrary indicator overloaded with an IDataSeries input to achieve the sync.
    The indicator can be any indicator. The DataSeries will be synced to whatever the
    BarsArray[] is provided.*/
    diff = new DataSeries(SMA(BarsArray[1], 50));
    }
    //checks we have enough bars to calculate
    if(CurrentBars[0] < BarsRequired || CurrentBars[1] < BarsRequired)
    return;
    double marker = 0;
    //double marker2 = 0;
    if (BarsInProgress == 0)
    {





    if (CurrentBar < 2)
    return;
    double Open12 = Opens[1][2];
    double Close12 = Closes[1][2];
    double Open11 = Opens[1][1];
    double Close11 = Closes[1][1];
    double Open10 = Opens[1][0];
    double Close10 = Closes[1][0];
    double Open00 = Opens[0][0];
    double Close00 = Closes[0][0];

    if (Open12 > Close12 && Open11 < Close11 && Open10 < Close10)
    {
    marker = marker + 1;
    }

    Marker.Set(marker);

    }


    if (BarsInProgress == 1)
    {
    if (CurrentBar < 2)
    return;


    }




    }

    Leave a comment:


  • koganam
    replied
    Originally posted by andrew-aut1 View Post
    Hey all,

    got a problem I have never had so far. I programmed a simple multitimeframe indicator and its plot is absolutely correct => takes on the value 1 when it should be. (see: screenshot attached) But when I try to backtest the strategy (this indicator == an indicator which only holds the value one => then entry /*which has always worked fine with any other strategy so far*/) it does not enter and I don't know why.

    Has it got something to do with the multiple timeframe concept? Any suggestion what I'm doing wrong?

    Being really grateful for your help,

    Andrew
    What is the error in your log?

    Leave a comment:


  • NinjaTrader_Bertrand
    replied
    What entry condition would you use here Andrew for the indicator? The plot hitting the value of 1 for going long?

    Leave a comment:


  • andrew-aut1
    started a topic Does not enter the trade

    Does not enter the trade

    Hey all,

    got a problem I have never had so far. I programmed a simple multitimeframe indicator and its plot is absolutely correct => takes on the value 1 when it should be. (see: screenshot attached) But when I try to backtest the strategy (this indicator == an indicator which only holds the value one => then entry /*which has always worked fine with any other strategy so far*/) it does not enter and I don't know why.

    Has it got something to do with the multiple timeframe concept? Any suggestion what I'm doing wrong?

    Being really grateful for your help,

    Andrew
    Attached Files

Latest Posts

Collapse

Topics Statistics Last Post
Started by Kimland, Today, 05:23 PM
0 responses
3 views
0 likes
Last Post Kimland
by Kimland
 
Started by ahm1992, Today, 04:56 PM
0 responses
10 views
0 likes
Last Post ahm1992
by ahm1992
 
Started by countjoemoney, Today, 01:16 PM
0 responses
10 views
0 likes
Last Post countjoemoney  
Started by fx.practic, Today, 12:59 PM
0 responses
7 views
0 likes
Last Post fx.practic  
Started by TheNomadicAspie, Today, 12:07 PM
0 responses
8 views
0 likes
Last Post TheNomadicAspie  
Working...
X