Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Help with a order

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

  • NinjaTrader_PatrickH
    replied
    Hello firecan,

    Thank you for your response.

    You need to set EntriesPerDirection to 3 and EntryHandling to AllEntries: http://www.ninjatrader.com/support/h...ryhandling.htm

    Then give unique entrySignalNames and use them for fromEntrySignalName in the SetProfitTarget and SetTrailStop methods:
    Code:
    protected override void Initialize()
    {
        EntriesPerDirection = 3;
        EntryHandling = EntryHandling.AllEntries;
    SetProfitTarget("ole1", CalculationMode.Ticks, 8);
    SetProfitTarget("ole2", CalculationMode.Ticks, 16);
    SetProfitTarget("ole3", CalculationMode.Ticks, 20);
    SetTrailStop("ole3", CalculationMode.Ticks, 20, false);
    
    CalculateOnBarClose = true;
    }
    
    protected override void OnBarUpdate()
    {
    // Condition set 1
    if (Close[0] > Close[1])
    {
    EnterLong(MyInput0, "ole1");
    EnterLong(MyInput0, "ole2");
    EnterLong(MyInput0, "ole3");
    }

    Leave a comment:


  • firecan
    replied
    I do not know the answer at your questions.
    Only I have this code.
    I am beginning.
    can you send me any example.
    Regards.

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hello,

    Are you using the fromSignalName that is the matching signalName used by the entry?

    For example:

    EnterLong(1, "longEntry1");
    SetStopLoss("longEntry1", CalculationMode.Ticks, 20, false)
    SetStopLoss(string fromEntrySignal, CalculationMode mode, double value, bool simulated)
    http://www.ninjatrader.com/support/h...etstoploss.htm

    Also, what is the Entries per direction set to in the strategy parameters?

    Leave a comment:


  • firecan
    replied
    Profit 3

    Hello.
    I cannot introduce this change
    All is ok, but when i introduce Target2 and Target3 they are ingnored.

    I try to enter with 3 contracts.
    The first one with profit to 8 ticks.
    The second one with profit to 16 ticks.
    The third runs with the trailstop.

    Can help me.

    Regards.

    ----------------------------------------------------------------------------------

    #region Variables
    private int myInput0 = 3; //Total contrats
    #endregion
    protected override void Initialize()
    {
    SetProfitTarget("", CalculationMode.Ticks, 8);
    // SetProfitTarget("2", CalculationMode.Ticks, 16);
    // SetProfitTarget("3", CalculationMode.Ticks, 20);

    SetTrailStop("", CalculationMode.Ticks, 20, false);

    CalculateOnBarClose = true;
    }

    protected override void OnBarUpdate()
    {
    // Condition set 1
    if (Close[0] > Close[1])
    {
    EnterLong(MyInput0, "ole");
    }
    Last edited by firecan; 10-31-2014, 02:39 PM.

    Leave a comment:


  • firecan
    replied
    Thanks again.

    ("F4") or ("0.000")

    Regards.

    Leave a comment:


  • koganam
    replied
    Originally posted by firecan View Post
    Thanks again.

    But print 18 digits. 0,00235189521452356

    What can I do to only print 0,002

    Regards.
    Math.Round()?

    ref: http://msdn.microsoft.com/en-us/libr...(v=vs.90).aspx

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hi firecan,

    To format a number of decimal places, use the double.ToString() method with a fixed point format specifier.

    myDouble.ToString("F2")

    http://msdn.microsoft.com/en-us/libr...v=vs.110).aspx

    Leave a comment:


  • firecan
    replied
    Print

    Thanks again.

    But print 18 digits. 0,00235189521452356

    What can I do to only print 0,002

    Regards.

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hi firecan,

    Print() will print to the output window. (Tools -> Output Window...)

    If you want to draw text below the bar, use DrawText().

    For example:

    DrawText("myText"+CurrentBar, (EMA(5)[0]-EMA(5)[1]).ToString(), 0, Low[0]-3*TickSize, Color.Blue) ;

    http://www.ninjatrader.com/support/h...7/drawtext.htm

    Leave a comment:


  • firecan
    replied
    Print

    Hello I have tried almost of everything without result
    Can someone to say the correct code to me to print under every bar the difference between EMA(0) and EMA(1).

    Print (EMA(5)[0] - EMA(5)[1])

    Regards.

    Leave a comment:


  • firecan
    replied
    Fantastic

    Fantastic for that we are beginning.

    Best impossible, with code and everything.

    Very grateful.

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hello firecan,

    If you would like to prevent orders from entering when the current bars time is equal to the previous bars time, write a check for the time in the condition. Use a string so that it compares the second, or minute, or whatever part of the time and date you would like.

    For example:

    Code:
    if (CurrentBar < 2)
    return;
    
    if (Time[0].ToString("M/d/yyyy hh:mm:ss") != Time[1].ToString("M/d/yyyy hh:mm:ss") &&
    		Close[0] > EMA(10)[0])
    {
    	//execute code
    }

    Leave a comment:


  • firecan
    replied
    Renko

    Thanks for your fast reply.



    2 question:

    The bars 1, 2, 3 and 4 go Long for the condition ok.

    The bar 5 no enter because the condition not ok.

    But the bars 6, 7 and 8 have the same time

    And it happens that 6 and 7 bars does not launch orders but 8 launches three.

    Is posible to have only one launches though 3 bars exist with the same time.

    Regards.

    Leave a comment:


  • koganam
    replied
    Originally posted by firecan View Post
    Hello I have two questions about a renko graph.

    The first one:

    In a moment of high volatility, I can see some bars with the same time.

    Is it possible to change the color of this bars with the same time?

    Up bars = green

    Down bars = red

    Bars with same time = White (Up and Down)

    Regards.
    You would have to write an indicator to do it. The main code would be:
    Code:
    if (Close[0] > Open[0]) BarColor = Color.Green;
    else if (Close[0] < Open[0]) BarColor = Color.Red;
    else  BarColor = Color.White;

    Leave a comment:


  • firecan
    replied
    New question

    Hello I have two questions about a renko graph.

    The first one:

    In a moment of high volatility, I can see some bars with the same time.

    Is it possible to change the color of this bars with the same time?

    Up bars = green

    Down bars = red

    Bars with same time = White (Up and Down)

    Regards.

    Leave a comment:

Latest Posts

Collapse

Topics Statistics Last Post
Started by FrancisMorro, Today, 03:24 AM
0 responses
1 view
0 likes
Last Post FrancisMorro  
Started by Segwin, 05-07-2018, 02:15 PM
10 responses
1,770 views
0 likes
Last Post Leafcutter  
Started by Rapine Heihei, 04-23-2024, 07:51 PM
2 responses
31 views
0 likes
Last Post Max238
by Max238
 
Started by Shansen, 08-30-2019, 10:18 PM
24 responses
944 views
0 likes
Last Post spwizard  
Started by Max238, Today, 01:28 AM
0 responses
11 views
0 likes
Last Post Max238
by Max238
 
Working...
X