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

strategy ninja script help

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

    strategy ninja script help

    Does anyone know how to put this strategy into ninja script it is from tradestation easylanguage.


    inputs:Prof(0),protstopamt(0),bkoutbuy(10),Bkoutse ll(0),bkbuy(0),bksell(0),r(4),s(6),u(5),
    smthlen(3),price(close),raw(25),smoothed(13),smoth len(5);
    var:High1(0),Low1(0),high2(0),low2(0),Myexitstop(0 ),blueline(0),redline(0),blackline(0),
    yellowline(0),EtsiBuy(false),EtsiSell(false),TsiBu y(false),Tsisell(false),Candlebuy(0),
    Candlesell(0),threebarhigh(0),threebarlow(0),
    canbuytrade(false),canselltrade(false),failbuy(0), failsell(0);
    value1=close;
    value2=entriestoday(date);
    {condition1=high[2]>high[1]and high[1]>high;
    condition2=low[2]<low[1]and low[1]<low; }

    Blueline=Tsi(Price,r,s,u);{ETSI Value part 1 of 2}
    Redline=XAverage(Tsi(Price,r,s,u),SmthLen);{Signal Line Average Of ETsi part 1 above}
    EtsiBuy=Blueline crosses over Redline ;
    EtsiSell=Blueline crosses under Redline ;
    Blackline=Tsi(price,raw,smoothed,1);{Tsi value part 1 of 2}
    YellowLine=XAverage(Tsi(price,raw,smoothed,1),smot hlen);{Signal line Average of Tsi part 1 above}
    TsiBuy=Blackline crosses over yellowline ;
    TsiSell=Blackline crosses under yellowline ;
    If Marketposition =(0) and time >0700 and time < 1330 and value2<5 then
    begin

    If close<close[1]and close[1]<close[2]then
    begin
    threebarlow=low[2];
    end;
    If close>close[1]and close[1]>close[2]then
    buy("Buy 3Highs")4 contracts next bar at low[2] limit;
    If close<close[1]and close[1]<close[2]then
    begin
    Threebarhigh=high[2];
    end;
    If close<close[1]and close[1]<close[2]then
    Sellshort("Sell 3Lows")4 contracts next bar at threebarhigh limit;
    end;
    If MarketPosition = 1 then
    begin

    If value1<entryprice and barssinceentry>1 then
    sell ("Failbuy")next bar at entryprice limit;
    myExitStop = entryprice - protstopamt points;
    sell("MMLStop")next bar at myExitStop stop;

    If CurrentContracts = 4 then
    Sell("tgts")2 contracts next bar at entryprice + prof points limit
    else

    If CurrentContracts = 2 then
    Sell("tgts1")1 contract next bar at entryprice + 4 points limit
    else

    If CurrentContracts = 1 then
    myExitStop = maxlist(myExitStop,lowest(low,5));
    Sell("trlsell")1 contract next bar at myExitStop stop;

    end;

    If MarketPosition = -1 then
    begin

    If value1>entryprice and barssinceentry >1 then
    buytocover("Failsell")next bar at value1 limit;
    myExitStop = entryprice + protstopamt points;
    buy to cover ("MMSStop") next bar at myExitstop stop;

    If CurrentContracts =4 then
    BuytoCover ("tgtB")2 contracts next bar at entryprice - prof points limit

    else

    If CurrentContracts =2 then
    BuytoCover ("tgtb1")1 contract next bar at entryprice - 4 points limit
    else

    If CurrentContracts = 1 then
    myExitStop = minlist(myExitStop,highest(high,5));
    BuytoCover("trlbuy")1 contract next bar at myExitStop stop ;

    end;

    setexitonclose;

    #2
    As last resort a certified NinjaScript consultant is at your help: http://www.ninjatrader.com/webnew/pa...injaScript.htm

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by cre8able, Yesterday, 01:16 PM
    3 responses
    11 views
    0 likes
    Last Post cre8able  
    Started by ChartTourist, Today, 08:22 AM
    0 responses
    4 views
    0 likes
    Last Post ChartTourist  
    Started by LiamTwine, Today, 08:10 AM
    0 responses
    2 views
    0 likes
    Last Post LiamTwine  
    Started by Balage0922, Today, 07:38 AM
    0 responses
    5 views
    0 likes
    Last Post Balage0922  
    Started by JoMoon2024, Today, 06:56 AM
    0 responses
    6 views
    0 likes
    Last Post JoMoon2024  
    Working...
    X