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

Stupid doubt picking brains

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

    Stupid doubt picking brains

    Hey guys, im using SetStopLoss order within a strategy and i have an existential doubt, lol, cant go on without clearing it:

    The help guide says this about the order:

    Definition
    Generates a stop loss order to exit a position. Stop loss orders are real working orders (unless simulated is specified in which case the stop order is locally simulated and submitted as market once triggered) submitted immediately to the market upon receiving an execution from an entry order.

    Does this mean that in case for Ninja to be connected with a real FXCM account, will place a real order inside FXCM and in the event of a power-down the order will still be remain within FXCM?

    Thank you!

    #2
    Hello kabott,

    Thanks for your post.

    With reference to this link: http://ninjatrader.com/support/forum...ead.php?t=5349 I've copied the relevant FXCM info here:
    FXCM
    Orders in a state "Accepted" or "Working" are on FXCM servers.
    OCO (One Cancels Other) functionality is simulated on your local PC.

    If your question is about the bool for simulated in the setStopLoss, when it is set to true a working stop order is not sent to FXCM but is monitored in your PC and when price hits the stop then the PC would send a market order to FXCM.
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      So that brings up an other question: My strategy uses 3 orders

      SetStopLoss ("target1", CalculationMode.Ticks, initialStopLoss , false);
      EnterLong ( "target1" );
      SetProfitTarget ("target1" , CalculationMode.Price, Close[0] + ( takeProfitTarget * TickSize));

      but its calculated OnBarClose=True;

      now, if the price reaches the target for the take profit in FXCM servers, but the candle hasnt closed yet in NinjaTrader renkos, how would that work?

      i mean would FXCM position be closed at take profit and Ninja will close it after the bar ends forming? i don't understand how that would work.

      Comment


        #4
        Hello kabott,

        Just to make sure we are on the same page here, you have 3 orders in your strategy but the profit target and stop are not actually placed until your entry has been filled. In the case of your setstoploss that appears like it would be placed immediately when the entry order has filled. In the case of the SetProfitTarget it will not be entered until the target price has been calculated according to your logic: Close[0] + ( takeProfitTarget * TickSize). So after your entry order has filled the stop loss is placed immediately and the next step is to calculate and place your profit target.

        I think the issue you need to work with is how you are using SetProfitTarget. By using the Close[0] value you are dynamically setting a specific price value, is that really what you want to do? I ask because that means that you would want to SetProfitTarget manually after the entry order has been filled and then you should use Position.AvgPrice instead of close[0]. Since you are using a market order Close[0] may not be where you get filled at. On the other hand if you preset the setProfitTarget to a set number of ticks the profit target would be entered immediately when the entry order is filled.



        The SetStopLoss and SetProfitTarget methods both submit their orders in realtime so while your strategy is COBC = true, the stop and target would be filled when price hits them (with consideration to normal fill issues).

        Please note the Tips section in each of these concerning the realtime operation:

        Paul H.NinjaTrader Customer Service

        Comment


          #5
          Hey Paul, thanks for the complete answer and for catching that about the take profit, you are absolutely right, i don't know what was i thinking!! You guys are the best!!. Honestly Ninja support blows everything away, there's no comparison what so ever!! Don't ever change the way you run support cause you cant improve whats already Perfect.

          Comment


            #6
            And now i know what was i thinking when i used Close[0] instead of AvgPrice

            when i use avg.price this happens:
            Click image for larger version

Name:	2015-10-08_222757.jpg
Views:	1
Size:	40.3 KB
ID:	874953

            So now i used Open[0] which is more aproximated to the real entry price since its at FirstTickOfBar

            Click image for larger version

Name:	2015-10-08_223013.jpg
Views:	1
Size:	39.9 KB
ID:	874954

            any suggestions?
            Last edited by kabott; 10-09-2015, 06:54 AM.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by bortz, 11-06-2023, 08:04 AM
            47 responses
            1,612 views
            0 likes
            Last Post aligator  
            Started by jaybedreamin, Today, 05:56 PM
            0 responses
            9 views
            0 likes
            Last Post jaybedreamin  
            Started by DJ888, 04-16-2024, 06:09 PM
            6 responses
            19 views
            0 likes
            Last Post DJ888
            by DJ888
             
            Started by Jon17, Today, 04:33 PM
            0 responses
            6 views
            0 likes
            Last Post Jon17
            by Jon17
             
            Started by Javierw.ok, Today, 04:12 PM
            0 responses
            22 views
            0 likes
            Last Post Javierw.ok  
            Working...
            X