• Тинькофф Банк-лучшие банковские продукты еще выгоднее
    Выбирайте продукт от банка Тинькофф
  • Уважаемые форумчане, друзья и посетители!
    Поступило предложение ( ссылка на обсуждение ) на сбор средств поддержания форума в рабочем состоянии с 1 июня ( оплата хостинга, бэкап ежедневный на другой хостинг и тд), отчетность будет предоставляться ежемесячно. Пока на ЮMoney ( яндекс деньги), доступно картой перевод, далее добавлю другие способы. Сумму перевода указывайте на ваш выбор исходя из своих возможностей.
    Форум продолжает свою работу благодаря Вашим пожертвованиям.

NinjaTrader WCCI Traders

ну Ок .Как будет результат , поделитесь , интересно что получится :)
 
Последнее редактирование:
Попробуй на 3 минутках
Iman, интересно, почему именно 3 минуты, и, это рекомендация для Playback (MarketReplay) или для StrategyAnalyzer? Если для последнего, то в нём никак не получается потестировать/пооптимизировать WoodiesCCIAutoTrader_NT8. Даже не знаю, где и как искать решение... Сейчас пришла идея, попросить программистов, которые программно глубоко владеют видением NT8, что бы посмотрели своим взглядом и подсказали решение о нормальном запуске тестирования стратегии. Особенно хотелось бы такое сообщение от NT8...
 
Муратик,
я твою стратегию не видел и могу только догадываться.
Если она работает с встроенной АТМ, то как я уже писал бэктэстить не получится.
Если я не путаю Води сам работал на ТФ 3м
 
Это очень странно - на Playback Connection работает...
Advanced Trade Management (ATM) F1.
Muratik, думаю ты знаешь как сделать АТМ и сохранить ёе. Если нет, то F1.
А стратегии с ордерами, исполняющимися через АТМ стратегию
тестить на бэктэсте у меня на нт7 не получалось. Думаю, что это вообще невозможно. Но, можно прогнать на MarketReplay.

на Strategy Analyzer не будет работать
 
Читается как окончательный приговор...
Iman, Благодарю!
 
без АТМ стратегии протестируй именно саму WoodiesCCIAutoTrader_NT8 .
Просто стоп и таргет задай только .
Тогда получится протестировать в Strategy Analyzer .
В стратежи аналайзере не получается потому что это вариант с тремя переменными ! он не может такой вариант просчитать .
Ему нужны четкие параметры или стоп или таргет .
Но для того что бы убедиться что стратегия работает - этого будет достаточно .
как то так .
 
Последнее редактирование:
В стратежи аналайзере не получается потому что это вариант с тремя переменными ! он не может такой вариант просчитать .
Теоретически, ну и практически, можно написать такой скрипт для StrategyAnalyzer, который эту невозможность в нём заменил бы на возможность? Вопрос программирующим на NT8.
 
чего-то мне не верится, что такая общественная халява будет кому-то приносить доход
 
Не понятно где в настройках задать стоп и таргет:
Посмотреть вложение 4929
там надо разбираться , по скрину не скажу . В верхнем поле где АТМ стратежи выбора в выпадающем меню нет ни какого ?
***********************************************************************************************************
Моё предложение как и писал выше , не морочить себе голову , запустить на живом демо 14 дней . если рез будет тогда уже дальше копаться и разбираться . это максимально приближенно к реальности , но не реальность .
Бек тест это просто красивая картинка будет и всё :) .
 
В верхнем поле где АТМ стратежи выбора в выпадающем меню нет ни какого ?
К сожалению, нет.
Моё предложение как и писал выше , не морочить себе голову , запустить на живом демо 14 дней . если рез будет тогда уже дальше копаться и разбираться . это максимально приближенно к реальности , но не реальность .
Бек тест это просто красивая картинка будет и всё :) .
Nikolaevich, всё правильно, абсолютно согласен с Вами!
Но мне важен (теперь уже был) не бэктест стратегии, а её Оптимизация - очень быстрая и очень удобная, но... для случая с ATM - к огромному сожалению, не доступная.
В этом всём хорошо то, что обнаружилась не доработка разработчиков NT8. Если найдут способ работать с роботами в StrategyAnalyzer с ATM стратегиями - ценность этого модуля станет ещё больше!
 
В наборе стратегий по умолчанию, в NT8, есть стратегия @SampleAtmStrategy:
C#:
#region Using declarations
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
using System.Windows.Media;
using System.Xml.Serialization;
using NinjaTrader.Cbi;
using NinjaTrader.Gui;
using NinjaTrader.Gui.Chart;
using NinjaTrader.Gui.SuperDom;
using NinjaTrader.Data;
using NinjaTrader.NinjaScript;
using NinjaTrader.Core.FloatingPoint;
using NinjaTrader.NinjaScript.Indicators;
using NinjaTrader.NinjaScript.DrawingTools;
#endregion

//This namespace holds Strategies in this folder and is required. Do not change it.
namespace NinjaTrader.NinjaScript.Strategies
{
    public class SampleAtmStrategy : Strategy
    {

        private string  atmStrategyId            = string.Empty;
        private string  orderId                    = string.Empty;
        private bool    isAtmStrategyCreated    = false;

        protected override void OnStateChange()
        {
            if (State == State.SetDefaults)
            {
                Description    = NinjaTrader.Custom.Resource.NinjaScriptStrategyDescriptionSampleATMStrategy;
                Name        = NinjaTrader.Custom.Resource.NinjaScriptStrategyNameSampleATMStrategy;
                // This strategy has been designed to take advantage of performance gains in Strategy Analyzer optimizations
                // See the Help Guide for additional information
                IsInstantiatedOnEachOptimizationIteration = false;
            }
        }

        protected override void OnBarUpdate()
        {
            if (CurrentBar < BarsRequiredToTrade)
                return;

            // HELP DOCUMENTATION REFERENCE: Please see the Help Guide section "Using ATM Strategies" under NinjaScript--> Educational Resources--> http://ninjatrader.com/support/helpGuides/nt8/en-us/using_atm_strategies.htm

            // Make sure this strategy does not execute against historical data
            if(State == State.Historical)
                return;

            // Submits an entry limit order at the current low price to initiate an ATM Strategy if both order id and strategy id are in a reset state
            // **** YOU MUST HAVE AN ATM STRATEGY TEMPLATE NAMED 'AtmStrategyTemplate' CREATED IN NINJATRADER (SUPERDOM FOR EXAMPLE) FOR THIS TO WORK ****
            if (orderId.Length == 0 && atmStrategyId.Length == 0 && Close[0] > Open[0])
            {
                isAtmStrategyCreated = false;  // reset atm strategy created check to false
                atmStrategyId = GetAtmStrategyUniqueId();
                orderId = GetAtmStrategyUniqueId();
                AtmStrategyCreate(OrderAction.Buy, OrderType.Limit, Low[0], 0, TimeInForce.Day, orderId, "AtmStrategyTemplate", atmStrategyId, (atmCallbackErrorCode, atmCallBackId) => {
                    //check that the atm strategy create did not result in error, and that the requested atm strategy matches the id in callback
                    if (atmCallbackErrorCode == ErrorCode.NoError && atmCallBackId == atmStrategyId)
                        isAtmStrategyCreated = true;
                });
            }

            // Check that atm strategy was created before checking other properties
            if (!isAtmStrategyCreated)
                return;

            // Check for a pending entry order
            if (orderId.Length > 0)
            {
                string[] status = GetAtmStrategyEntryOrderStatus(orderId);

                // If the status call can't find the order specified, the return array length will be zero otherwise it will hold elements
                if (status.GetLength(0) > 0)
                {
                    // Print out some information about the order to the output window
                    Print("The entry order average fill price is: " + status[0]);
                    Print("The entry order filled amount is: " + status[1]);
                    Print("The entry order order state is: " + status[2]);

                    // If the order state is terminal, reset the order id value
                    if (status[2] == "Filled" || status[2] == "Cancelled" || status[2] == "Rejected")
                        orderId = string.Empty;
                }
            } // If the strategy has terminated reset the strategy id
            else if (atmStrategyId.Length > 0 && GetAtmStrategyMarketPosition(atmStrategyId) == Cbi.MarketPosition.Flat)
                atmStrategyId = string.Empty;

            if (atmStrategyId.Length > 0)
            {
                // You can change the stop price
                if (GetAtmStrategyMarketPosition(atmStrategyId) != MarketPosition.Flat)
                    AtmStrategyChangeStopTarget(0, Low[0] - 3 * TickSize, "STOP1", atmStrategyId);

                // Print some information about the strategy to the output window, please note you access the ATM strategy specific position object here
                // the ATM would run self contained and would not have an impact on your NinjaScript strategy position and PnL
                Print("The current ATM Strategy market position is: " + GetAtmStrategyMarketPosition(atmStrategyId));
                Print("The current ATM Strategy position quantity is: " + GetAtmStrategyPositionQuantity(atmStrategyId));
                Print("The current ATM Strategy average price is: " + GetAtmStrategyPositionAveragePrice(atmStrategyId));
                Print("The current ATM Strategy Unrealized PnL is: " + GetAtmStrategyUnrealizedProfitLoss(atmStrategyId));
            }
        }
    }
}

Может с её помощью можно поискать решение?
 

Вложения

  • @SampleAtmStrategy.cs
    4,9 КБ · Просмотры: 4
  • Like
Реакции: Iman
В наборе стратегий по умолчанию, в NT8, есть стратегия @SampleAtmStrategy:
C#:
#region Using declarations
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
using System.Windows.Media;
using System.Xml.Serialization;
using NinjaTrader.Cbi;
using NinjaTrader.Gui;
using NinjaTrader.Gui.Chart;
using NinjaTrader.Gui.SuperDom;
using NinjaTrader.Data;
using NinjaTrader.NinjaScript;
using NinjaTrader.Core.FloatingPoint;
using NinjaTrader.NinjaScript.Indicators;
using NinjaTrader.NinjaScript.DrawingTools;
#endregion

//This namespace holds Strategies in this folder and is required. Do not change it.
namespace NinjaTrader.NinjaScript.Strategies
{
    public class SampleAtmStrategy : Strategy
    {

        private string  atmStrategyId            = string.Empty;
        private string  orderId                    = string.Empty;
        private bool    isAtmStrategyCreated    = false;

        protected override void OnStateChange()
        {
            if (State == State.SetDefaults)
            {
                Description    = NinjaTrader.Custom.Resource.NinjaScriptStrategyDescriptionSampleATMStrategy;
                Name        = NinjaTrader.Custom.Resource.NinjaScriptStrategyNameSampleATMStrategy;
                // This strategy has been designed to take advantage of performance gains in Strategy Analyzer optimizations
                // See the Help Guide for additional information
                IsInstantiatedOnEachOptimizationIteration = false;
            }
        }

        protected override void OnBarUpdate()
        {
            if (CurrentBar < BarsRequiredToTrade)
                return;

            // HELP DOCUMENTATION REFERENCE: Please see the Help Guide section "Using ATM Strategies" under NinjaScript--> Educational Resources--> http://ninjatrader.com/support/helpGuides/nt8/en-us/using_atm_strategies.htm

            // Make sure this strategy does not execute against historical data
            if(State == State.Historical)
                return;

            // Submits an entry limit order at the current low price to initiate an ATM Strategy if both order id and strategy id are in a reset state
            // **** YOU MUST HAVE AN ATM STRATEGY TEMPLATE NAMED 'AtmStrategyTemplate' CREATED IN NINJATRADER (SUPERDOM FOR EXAMPLE) FOR THIS TO WORK ****
            if (orderId.Length == 0 && atmStrategyId.Length == 0 && Close[0] > Open[0])
            {
                isAtmStrategyCreated = false;  // reset atm strategy created check to false
                atmStrategyId = GetAtmStrategyUniqueId();
                orderId = GetAtmStrategyUniqueId();
                AtmStrategyCreate(OrderAction.Buy, OrderType.Limit, Low[0], 0, TimeInForce.Day, orderId, "AtmStrategyTemplate", atmStrategyId, (atmCallbackErrorCode, atmCallBackId) => {
                    //check that the atm strategy create did not result in error, and that the requested atm strategy matches the id in callback
                    if (atmCallbackErrorCode == ErrorCode.NoError && atmCallBackId == atmStrategyId)
                        isAtmStrategyCreated = true;
                });
            }

            // Check that atm strategy was created before checking other properties
            if (!isAtmStrategyCreated)
                return;

            // Check for a pending entry order
            if (orderId.Length > 0)
            {
                string[] status = GetAtmStrategyEntryOrderStatus(orderId);

                // If the status call can't find the order specified, the return array length will be zero otherwise it will hold elements
                if (status.GetLength(0) > 0)
                {
                    // Print out some information about the order to the output window
                    Print("The entry order average fill price is: " + status[0]);
                    Print("The entry order filled amount is: " + status[1]);
                    Print("The entry order order state is: " + status[2]);

                    // If the order state is terminal, reset the order id value
                    if (status[2] == "Filled" || status[2] == "Cancelled" || status[2] == "Rejected")
                        orderId = string.Empty;
                }
            } // If the strategy has terminated reset the strategy id
            else if (atmStrategyId.Length > 0 && GetAtmStrategyMarketPosition(atmStrategyId) == Cbi.MarketPosition.Flat)
                atmStrategyId = string.Empty;

            if (atmStrategyId.Length > 0)
            {
                // You can change the stop price
                if (GetAtmStrategyMarketPosition(atmStrategyId) != MarketPosition.Flat)
                    AtmStrategyChangeStopTarget(0, Low[0] - 3 * TickSize, "STOP1", atmStrategyId);

                // Print some information about the strategy to the output window, please note you access the ATM strategy specific position object here
                // the ATM would run self contained and would not have an impact on your NinjaScript strategy position and PnL
                Print("The current ATM Strategy market position is: " + GetAtmStrategyMarketPosition(atmStrategyId));
                Print("The current ATM Strategy position quantity is: " + GetAtmStrategyPositionQuantity(atmStrategyId));
                Print("The current ATM Strategy average price is: " + GetAtmStrategyPositionAveragePrice(atmStrategyId));
                Print("The current ATM Strategy Unrealized PnL is: " + GetAtmStrategyUnrealizedProfitLoss(atmStrategyId));
            }
        }
    }
}

Может с её помощью можно поискать решение?


// **** YOU MUST HAVE AN ATM STRATEGY TEMPLATE NAMED 'AtmStrategyTemplate' CREATED IN NINJATRADER (SUPERDOM FOR EXAMPLE) FOR THIS TO WORK ****

Молодец Муратик, под лежащий камень вода не течёт.
Это пример стратегии с функционалом АТМ, т.е. можешь поместить сюда код своей стратегии и исполнение ордеров будет происходить через АТМ. А название своей заранее сделанной АТМ стратегии, нужно поместить сюда - "AtmStrategyTemplate".
Возврат к начальной точке - АТМ.

P.s. Я тебя не обламываю, сам в своё время набил шишки.
 
Iman, сильно обнадёжили - Благодарю!:Hi:

// **** YOU MUST HAVE AN ATM STRATEGY TEMPLATE NAMED 'AtmStrategyTemplate' CREATED IN NINJATRADER (SUPERDOM FOR EXAMPLE) FOR THIS TO WORK ****
Это пример стратегии с функционалом АТМ, т.е. можешь поместить сюда код своей стратегии и исполнение ордеров будет происходить через АТМ. А название своей заранее сделанной АТМ стратегии, нужно поместить сюда - "AtmStrategyTemplate".
Возврат к начальной точке - АТМ.

Грамотно поместить код WCCI_AT.cs (такое название у WoodiesCCIAutoTrader_NT8 в папке Documents\NinjaTrader 8\bin\Custom\Strategies) и название ATM 1 (сделанная заранее ATM стратегия) в правильные места для них, у меня не получиться. В программировании полный дилетант.
 
// **** YOU MUST HAVE AN ATM STRATEGY TEMPLATE NAMED 'AtmStrategyTemplate' CREATED IN NINJATRADER (SUPERDOM FOR EXAMPLE) FOR THIS TO WORK ****
Это пример стратегии с функционалом АТМ, т.е. можешь поместить сюда код своей стратегии и исполнение ордеров будет происходить через АТМ. А название своей заранее сделанной АТМ стратегии, нужно поместить сюда - "AtmStrategyTemplate".
Возврат к начальной точке - АТМ.
Приложил файлы из NT8 - на случай, может у кого нибудь, опытного в таких делах, появиться желание проделать вышеизложенное Iman.
 

Вложения

  • WCCI_AT.cs
    26,6 КБ · Просмотры: 4
  • ATM 1.xml
    4,5 КБ · Просмотры: 4
Назад
Верх Низ