Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Help programmazione

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

  • NinjaTrader_Brett
    replied
    Italy,

    There is no need to write if statements, What you would do is add these to the top of your Initilize() method and they only need to added once to the strategy, once added when you place an order long or short and it is filled the strategy will automatically submit the stop loss and profit target for you.

    5% would be written as .05

    Also no need to add Position.Avgprice +5%, just put .05 here like the example I showed you and it will put the stop .05 or 5 percent below the average entry price for you automatically.

    The below code will submit stop loss 5 percent away from your entry price automatically once you EnterLong or EnterShort.


    protected override void Initialize()
    {

    SetStopLoss(
    CalculationMode.Percent,0.05);
    }

    Let me know if I can be of further assistance.

    Leave a comment:


  • Italy
    replied
    OK Brett,
    now if the position stock moves into profit by 5% (target1) port is located in a tie.
    example:
    if (High [0]> Position.AvgPrice + 5%) / / how should I write for 5% increase?
    SetStopLoss (LongBuy "CalculationMode.Percent, Position.AvgPrice, false);

    If he continues to profit , example of another 7% (TARGET2) port located on the stop target1.
    example:
    if (High [0]> Position.Avgprice +5% +7% / / as you write?
    SetStopLoss (LongBuy "CalculationMode.Percent, Position.Avgprice +5% (target1) / / as you write?
    Thank you.
    Hello.
    Roberto

    Leave a comment:


  • NinjaTrader_Brett
    replied
    Hello,

    There are no need for changes or overides that you need to do to be allowed to do this as this is built in already. You can change the CalculationMode to Percent when you use SetStopLoss or SetProfitTarget. Use the below as an example:

    SetProfitTarget("Long1",CalculationMode.Percent,0.01);

    http://www.ninjatrader-support.com/H...fitTarget.html

    Let me know if I can be of further assistance.

    Leave a comment:


  • Italy
    replied
    Hello everyone,
    here is my problem:
    Ninja7 use (under study) under the link for Yahoo daily historical data on which to practice and do some back testing, failing in those minutes. Should I convert the following code set to tick with an approach to percentage.
    Example:

    # Region Positions
    private void GoLong ()
    (SetStopLoss (LongBuy "CalculationMode.Price, Close [0] - (Stop TickSize *), false);
    SetProfitTarget (LongBuy "CalculationMode.Price, Close [0] + (Fulltarget TickSize *));
    EnterLong (LongBuy ");

    I can not write that instead of 30 tichs stop must calculate 3% instead of 50 ticks of fulltarget must calculate 5%.
    Can anyone help me?
    Thank you.
    Hello.
    Roberto

    Leave a comment:


  • NinjaTrader_Brett
    replied
    Thanks for translating that.

    Unfortunately the Yahoo data feed only provides end of day data and the simulation engine cannot run on the yahoo data feed connection and requires a live data feed. Therefor you will be unable to use this until you connect to a data feed provider that supports live data.

    Leave a comment:


  • zweistein
    replied
    Ciao, ti traduco in inglese, qui tutto si svolge in inglese... (neanche in tedesco nonostante che qualche staff lo sia. La ditta ha la sede a Denver, Colorado in USA)
    Saluti
    Andreas


    He wants to set a stop loss of 3% and a profit target of 5%, but he is stuck with a sample for tick data only. His data feed is Yahoo daily.

    Leave a comment:


  • NinjaTrader_Brett
    replied
    Hello,

    Thank for your for first forum post.

    Unfortunately we only provide support in English. Can you please re submit the question in English so that I will be able to further assist.

    I look forward to assisting you further.

    Leave a comment:


  • Italy
    started a topic Help programmazione

    Help programmazione

    Ciao a tutti,
    ecco il mio problema:
    utilizzo Ninja7 (in fase di studio) con il collegamento Yahoo daily per avere dei dati storici su cui esercitarmi, non avendo quelli a minuti. Dovrei trasformare il codice seguente impostato a Tick con un'impostazione a percentuale.Quindi per esempio:

    #region Positions
    private void GoLong()
    {SetStopLoss("LongBuy", CalculationMode.Price, Close[0]-(Stop*TickSize), false);
    SetProfitTarget("LongBuy", CalculationMode.Price, Close[0]+(Fulltarget*TickSize));
    EnterLong("LongBuy");

    Ho provato da giorni ma non riesco a scrivere che invece di 30 tichs di stop deve calcolare 3% e invece di 50 ticks di fulltarget deve calcolare 5%.
    C'è qualcuno che può aiutarmi?
    Grazie.
    Ciao.

Latest Posts

Collapse

Topics Statistics Last Post
Started by atrader, Today, 09:29 AM
1 response
5 views
0 likes
Last Post NinjaTrader_Clayton  
Started by nailui, Today, 07:26 AM
1 response
28 views
0 likes
Last Post NinjaTrader_Spencer  
Started by chartchartchart, Today, 08:08 AM
1 response
5 views
0 likes
Last Post NinjaTrader_Emily  
Started by andreslazor7, Today, 08:08 AM
3 responses
16 views
0 likes
Last Post NinjaTrader_ChristopherJ  
Started by FatCanary, Today, 08:09 AM
2 responses
10 views
0 likes
Last Post FatCanary  
Working...
X