Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Esignal ATI

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

    Esignal ATI

    Hi,
    I had a efs script develop few year back but now when i load in esignal chart it load and when it sends singal to NT for buy/sell but NT dont execute it and in log it says unknown instrument '6E #F'. When i had it made that time it was working perfectly.
    Here is the script:-

    var dll = new DLL("NtDirect.dll");
    var orderPlaced = false;
    var printDone = false;

    function preMain() {
    setPriceStudy(true);
    setStudyTitle("MA");

    setCursorLabelName("MA",0);
    setDefaultBarFgColor(Color.yellow,0);
    setDefaultBarThickness(2,0);
    //setComputeOnClose();


    var fp1 = new FunctionParameter("Length", FunctionParameter.NUMBER);
    fp1.setLowerLimit(1);
    fp1.setDefault(99); //Edit this value to set a new default

    dll.addFunction("AvgEntryPrice", DLL.DOUBLE, DLL.STDCALL, "AvgEntryPrice", DLL.STRING, DLL.STRING);
    dll.addFunction("AvgFillPrice", DLL.DOUBLE, DLL.STDCALL, "AvgFillPrice", DLL.STRING);
    dll.addFunction("Command", DLL.INT, DLL.STDCALL, "Command", DLL.STRING, DLL.STRING, DLL.STRING, DLL.STRING, DLL.INT, DLL.STRING, DLL.DOUBLE, DLL.DOUBLE, DLL.STRING, DLL.STRING, DLL.STRING, DLL.STRING, DLL.STRING);
    dll.addFunction("ConfirmOrders", DLL.INT, DLL.STDCALL, "ConfirmOrders", DLL.INT);
    dll.addFunction("Connected", DLL.INT, DLL.STDCALL, "Connected", DLL.INT);
    dll.addFunction("Filled", DLL.INT, DLL.STDCALL, "Filled", DLL.STRING);
    dll.addFunction("MarketPosition", DLL.INT, DLL.STDCALL, "MarketPosition", DLL.STRING, DLL.STRING);
    dll.addFunction("NewOrderId", DLL.STRING, DLL.STDCALL, "NewOrderId");
    dll.addFunction("Orders", DLL.STRING, DLL.STDCALL, "Orders", DLL.STRING);
    dll.addFunction("OrderStatus", DLL.STRING, DLL.STDCALL, "OrderStatus", DLL.STRING);
    dll.addFunction("RealizedPnL", DLL.STRING, DLL.STDCALL, "RealizedPnL", DLL.DOUBLE);
    dll.addFunction("SetUp", DLL.INT, DLL.STDCALL, "SetUp", DLL.STRING, DLL.INT);
    dll.addFunction("Strategies", DLL.STRING, DLL.STDCALL, "Strategies", DLL.STRING);
    dll.addFunction("StrategyPosition", DLL.INT, DLL.STDCALL, "StrategyPosition", DLL.STRING);
    dll.addFunction("TearDown", DLL.INT, DLL.STDCALL, "TearDown");
    }

    var id = 0;
    var entryPrice = 0;
    var buyCondition = false;
    var isInTrade = false;
    var isInLong = false;
    var isInShort = false;
    var entryPrice = 0;

    function main(Length) {
    var i = 0;
    var j = 0;
    var k = 0;

    if (getBarState() == BARSTATE_NEWBAR){
    isInTrade = false;
    }

    for(i = -50; i < 0; i++){
    if(low(i) > ema(Length, i))
    j++;
    if(high(i) < ema(Length, i))
    k++;
    }

    if(j == 50 && low(0) <= ema(Length) && !isInTrade){ //&& !Strategy.isLong()){
    Strategy.doLong("Long", Strategy.MARKET, Strategy.THISBAR);
    drawTextRelative(0,low(),"é",Color.lime,null,Text. CENTER | Text.TOP | Text.BOLD,"Wingdings",11,getID());
    Alert.addToList(getSymbol(), "Long" + " " + getSymbol() + " " + getInterval(), Color.lime, Color.black);
    Alert.playSound("Bullet.wav");
    isInTrade = true;
    isInLong = true;
    isInShort = false;
    entryPrice = ema(Length);
    NTCommand("Place", "", "Buy", 1, "Market", ema(Length), 0, "", "", "", 120, "");

    }
    if(k == 50 && high(0) >= ema(Length) && !isInTrade){ //&& !Strategy.isShort()){
    Strategy.doShort("Short", Strategy.MARKET, Strategy.THISBAR);
    drawTextRelative(0,high(),"ê",Color.red,null,Text. BOTTOM|Text.CENTER|Text.BOLD,"Wingdings",11,getID( ));
    Alert.addToList(getSymbol(), "Short" + " " + getSymbol() + " " + getInterval(), Color.red, Color.black);
    Alert.playSound("Bullet.wav");
    isInTrade = true;
    isInShort = true;
    isInLong = false;
    entryPrice = ema(Length);
    NTCommand("Place", "", "Sell", 1, "Market", ema(Length), 0, "", "", "", 120, "");

    }

    return new Array(ema(Length));
    }


    function getID() {
    id++;
    return id;
    }


    // Get the average entry price of a position of an account. "account" is optional.
    function NTAvgEntryPrice(account) {
    return dll.call("AvgEntryPrice", getSymbol(), account);
    }

    // Get the average fill price of an order.
    function NTAvgFillPrice(orderId) {
    return dll.call("AvgFillPrice", orderId);
    }

    // Place a buy limit order. "orderId" is optional (set to "" it not applicable).
    function NTBuyLimit(orderId, quantity, limitPrice) {
    return NTCommand("Place", "", "Buy", quantity, "Limit", limitPrice, 0, "", "", orderId, "", "");
    }

    // Place a buy market order. "orderId" is optional (set to "" it not applicable).
    function NTBuyMarket(orderId, quantity) {
    return NTCommand("Place", "", "Buy", quantity, "Market", 0, 0, "", "", orderId, "", "");
    }

    // Place a buy stop order. "orderId" is optional (set to "" it not applicable).
    function NTBuyStop(orderId, quantity, stopPrice) {
    return NTCommand("Place", "", "Buy", quantity, "Stop", 0, stopPrice, "", "", orderId, "", "");
    }

    // Place a buy stop limit order. "orderId" is optional (set to "" it not applicable).
    function NTBuyStopLimit(orderId, quantity, limitPrice, stopPrice) {
    return NTCommand("Place", "", "Buy", quantity, "StopLimit", limitPrice, stopPrice, "", "", orderId, "", "");
    }

    // Cancel an order by its order id.
    function NTCancel(orderId) {
    return NTCommand("Cancel", "", "", 0, "", 0, 0, "", "", orderId, "", "");
    }

    // Cancel all orders at all accounts.
    function NTCancelAllOrders() {
    return NTCommand("CancelAllOrders", "", "", 0, "", 0, 0, "", "", "", "", "");
    }

    // Change an order by its order id.
    function NTChange(orderId, quantity, limitPrice, stopPrice) {
    return NTCommand("Change", "", "", quantity, "", limitPrice, stopPrice, "", "", orderId, "", "");
    }

    // Close any position of the current instrument at an account. "account" is optional (set to "" it not applicable).
    function NTClosePosition(account) {
    return NTCommand("ClosePosition", account, "", 0, "", 0, 0, "", "", "", "", "");
    }

    // Submits a NinjaTrader command.
    function NTCommand(command, account, action, quantity, orderType, limitPrice, stopPrice, timeInForce, oco, orderId, template, strategy) {
    return dll.call("Command", command, account, getSymbol(), action, quantity, orderType,
    limitPrice, stopPrice, timeInForce, oco, orderId, template, strategy);
    }

    // Sets the order confirmation mode. 1 = confirmation required, else = no confirmation required.
    function NTConfirmOrders(confirm) {
    dll.call("ConfirmOrders", confirm);
    }

    // Indicates if the connection to NinjaTrader is established. 0 = connected, -1 not connected.
    function NTConnected(showMessage) {
    return (dll.call("Connected", showMessage) == 0)
    }

    // Get the filled of an order.
    function NTFilled(orderId) {
    return dll.call("Filled", orderId);
    }

    // Close all positions and cancels all order at all account.
    function NTFlattenEverything() {
    return NTCommand("FlattenEverything", "", "", 0, "", 0, 0, "", "", "", "", "");
    }

    // Get the market position of the current instrument at an account. "account" is optional (set to "" it not applicable).
    function NTMarketPosition(account) {
    return dll.call("MarketPosition", getSymbol(), account);
    }

    // Get a new unqiue order id.
    function NTNewOrderId() {
    return dll.call("NewOrderId");
    }

    // Get a string of order IDs of all orders initiated through the ATI of an account separated by '|'.
    function NTOrders(account) {
    return dll.call("Orders", account);
    }

    // Get the current status of an order.
    function NTOrderStatus(orderId) {
    return dll.call("OrderStatus", orderId);
    }

    // Get the realized P&L of an account.
    function NTRealizedPnL(account) {
    return dll.call("RealizedPnL", account);
    }

    // Place a sell limit order. "orderId" is optional (set to "" it not applicable).
    function NTSellLimit(orderId, quantity, limitPrice) {
    return NTCommand("Place", "", "Sell", quantity, "Limit", limitPrice, 0, "", "", orderId, "", "");
    }

    // Place a sell market order. "orderId" is optional (set to "" it not applicable).
    function NTSellMarket(orderId, quantity) {
    return NTCommand("Place", "", "Sell", quantity, "Market", 0, 0, "", "", orderId, "", "");
    }

    // Place a sell stop order. "orderId" is optional (set to "" it not applicable).
    function NTSellStop(orderId, quantity, stopPrice) {
    return NTCommand("Place", "", "Sell", quantity, "Stop", 0, stopPrice, "", "", orderId, "", "");
    }

    // Place a sell stop limit order. "orderId" is optional (set to "" it not applicable).
    function NTSellStopLimit(orderId, quantity, limitPrice, stopPrice) {
    return NTCommand("Place", "", "Sell", quantity, "StopLimit", limitPrice, stopPrice, "", "", orderId, "", "");
    }

    // Gets a string of strategy IDs of all strategies of an account separated by '|'. Duplicate ID values can be returned if strategies were initiated outside of the ATI.
    function NTStrategies(account) {
    return dll.call("Strategies", account);
    }

    // Get the position of a strategy.
    function NTStrategyPosition(strategyId) {
    return dll.call("StrategyPosition", strategyId);
    }
    __________________________________________________ ________________
    Could any please help tell me what to add to get the problem solved.

    Thanks.
    Khawaja

    #2
    Hello khawaja,

    We have discussed this via email. You will need to change the code so that you're submitting to the NT expected instrument: 6E 12-11.

    This help guide article can help with NTCommand needed for this.

    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_RyanM View Post
      Hello khawaja,

      We have discussed this via email. You will need to change the code so that you're submitting to the NT expected instrument: 6E 12-11.

      This help guide article can help with NTCommand needed for this.

      http://www.ninjatrader.com/support/h...parameters.htm
      Now u have directed the me to the right place last on email u didn't mention the address u just me to consider 3rd party NinjaScript consultants from where i can get help. this was what i need. it worked
      Thanks!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by RideMe, 04-07-2024, 04:54 PM
      6 responses
      31 views
      0 likes
      Last Post RideMe
      by RideMe
       
      Started by tkaboris, Today, 05:13 PM
      0 responses
      2 views
      0 likes
      Last Post tkaboris  
      Started by GussJ, 03-04-2020, 03:11 PM
      16 responses
      3,281 views
      0 likes
      Last Post Leafcutter  
      Started by WHICKED, Today, 12:45 PM
      2 responses
      19 views
      0 likes
      Last Post WHICKED
      by WHICKED
       
      Started by Tim-c, Today, 02:10 PM
      1 response
      10 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Working...
      X