Semi-automatic trading - NinjaTrader Programming | futures io social day trading
futures io futures trading


Semi-automatic trading
Updated: Views / Replies:3,596 / 22
Created: by maxi Attachments:3

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 3  
 
Thread Tools Search this Thread
 

Semi-automatic trading

  #1 (permalink)
Trading Apprentice
Rome, Italy
 
Futures Experience: Advanced
Platform: NinjaTrader
Favorite Futures: Equity Index Futures
 
Posts: 17 since Jul 2010
Thanks: 2 given, 0 received

Semi-automatic trading

Hi all,

I'm programming an indicator which sends orders to a strategy through a button on chart. Once in position inserts stoploss and profit target orders in OCO. SL and PT levels are calculated as soon as the entry order is sent and remain active until the order is filled. I'm not using ATM but a simple Strategy that is attached to the chart. Everything works fine with only a single chart, but, when I use it with more charts, the strategy inserts the SL and TP orders only on the first activated strategy. Does anybody faced a trouble like this or has any hints/suggestions for fixing it?

Thanks.

Reply With Quote
 
  #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.

 
  #3 (permalink)
Elite Member
Bala, PA, USA
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: Mirus, IB
Favorite Futures: SPY, Oil, Euro
 
monpere's Avatar
 
Posts: 1,858 since Jul 2010
Thanks: 300 given, 3,276 received



maxi View Post
Hi all,

I'm programming an indicator which sends orders to a strategy through a button on chart. Once in position inserts stoploss and profit target orders in OCO. SL and PT levels are calculated as soon as the entry order is sent and remain active until the order is filled. I'm not using ATM but a simple Strategy that is attached to the chart. Everything works fine with only a single chart, but, when I use it with more charts, the strategy inserts the SL and TP orders only on the first activated strategy. Does anybody faced a trouble like this or has any hints/suggestions for fixing it?

Thanks.

I've been trading like this exclusively for the past 3 or 4 years. How are you interfacing the indicator to the strategy?

Reply With Quote
 
  #4 (permalink)
Elite Member
Zurich Switzerland
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: IB
Favorite Futures: ES, 6E, CL
 
Posts: 404 since Sep 2009
Thanks: 64 given, 511 received


maxi View Post
Hi all,

I'm programming an indicator which sends orders to a strategy through a button on chart. Once in position inserts stoploss and profit target orders in OCO. SL and PT levels are calculated as soon as the entry order is sent and remain active until the order is filled. I'm not using ATM but a simple Strategy that is attached to the chart. Everything works fine with only a single chart, but, when I use it with more charts, the strategy inserts the SL and TP orders only on the first activated strategy. Does anybody faced a trouble like this or has any hints/suggestions for fixing it?

Thanks.

Using a similar concept, I solved most of my problems with a third file containing the outsourced global variables.

This file is placed on a chart that I never chage during the day (weekly chart).Now I can change timeframes when in a trade etc. without resetting the chart values in the charttrader chart. Using multiple strategies, global performance values etc.

This third file did it for me. Hard to guess if this will help with your code.

Reply With Quote
 
  #5 (permalink)
Trading Apprentice
Rome, Italy
 
Futures Experience: Advanced
Platform: NinjaTrader
Favorite Futures: Equity Index Futures
 
Posts: 17 since Jul 2010
Thanks: 2 given, 0 received

monpere:
The strategy is interfaced through a Global variable from an indicator, which sends command (ex: "Buy" ) as well as entry level and SL and PT levels. Entry order (in stop) is entered on button pressing, while the exit levels are activated only "On Execution".

If I use a single chart, everything works as expected, but, adding a second chart (different market), on execution of the entry order, TP and SL are not activated.

Strategies are both attached to any of the 2 charts, so I wouldn't see any reason for not working properly.

My idea is that the manual order could generate a bit of confusion and probably the variable should be "restarded".

I've already done a similar code through ATM and it worked, but that's easier because one has to create an ATM for any of the markets. The pity is that I need to have the number of shares/lots variable and this cannot be done with ATM.

terratec:

interesting idea, although my levels need to be changed often. What do you mean with a third file? A new indicator?

Thanks to all.

Reply With Quote
 
  #6 (permalink)
Elite Member
Milan (I)
 
Futures Experience: Advanced
Platform: Ninjatrader
Broker/Data: Kinetick
Favorite Futures: FDAX,6E,CL,YM,NQ,ES
 
redratsal's Avatar
 
Posts: 1,653 since Oct 2010
Thanks: 1,217 given, 2,068 received


maxi View Post
monpere:
The strategy is interfaced through a Global variable from an indicator, which sends command (ex: "Buy" ) as well as entry level and SL and PT levels. Entry order (in stop) is entered on button pressing, while the exit levels are activated only "On Execution".

If I use a single chart, everything works as expected, but, adding a second chart (different market), on execution of the entry order, TP and SL are not activated.

Strategies are both attached to any of the 2 charts, so I wouldn't see any reason for not working properly.

My idea is that the manual order could generate a bit of confusion and probably the variable should be "restarded".

I've already done a similar code through ATM and it worked, but that's easier because one has to create an ATM for any of the markets. The pity is that I need to have the number of shares/lots variable and this cannot be done with ATM.

terratec:

interesting idea, although my levels need to be changed often. What do you mean with a third file? A new indicator?

Thanks to all.

NinjaTrader would not support cross communication between instantiated strategy or indicator classes, a turnaround point could be to rename the same strategy for each and every one chart you want to be opened on your workspace.

Reply With Quote
 
  #7 (permalink)
Trading Apprentice
Rome, Italy
 
Futures Experience: Advanced
Platform: NinjaTrader
Favorite Futures: Equity Index Futures
 
Posts: 17 since Jul 2010
Thanks: 2 given, 0 received

Thanks for suggestion redratsal, I will try this.

(Grazie per il suggerimento)

Reply With Quote
 
  #8 (permalink)
Elite Member
Zurich Switzerland
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: IB
Favorite Futures: ES, 6E, CL
 
Posts: 404 since Sep 2009
Thanks: 64 given, 511 received


maxi View Post
terratec:

interesting idea, although my levels need to be changed often. What do you mean with a third file? A new indicator?

You have an indicator and a strategy. Somewhere you have to define your global stuff. If doing in the indicator or strategy you will have a problem if you use multiple charts / strategies.

So I use an indicator file (could also be a strategy), to have those declarations only once on my system and untouched for the day. In this file I just have the declarations of the variables, their standard values and some calculations like unrealized and realized P&L for all instruments etc.

All the other stuff like sending commands and feedback goes from indy to the strategy of that instrument and back to indy. The third file ist for declaration (and some extras) only. Code like this:

 
Code
public class Strategy_bTPAM_Global {
  	public static string command = "";	// does send commands from indicator to strategy
	public static double timeframe = 0;	// does send the timeframe from indicator to strategy
	public static string status = "";	// does send infos from strategy to indicator
	
	// price data from indicator to strategy
	public static int t1quantity = 0; // quantity for target1
	public static int t2quantity = 0; // quantity for target2
	public static double stoploss = 0; //sl ticks
	public static double target1 = 0; //t1 ticks
	public static double target2 = 0; //t2 ticks
	
	//constants for stop and targets used by indicator and strategy
	public static double baseTicksES = 8;
	public static double baseTicksYM = 16;
	public static double baseTicksNQ = 14;
	public static double baseTicks6E = 16;
	public static double baseTicksCL = 20;
	public static double baseTicksGC = 30;
	
	// Trading plan
	public static double dailylosslimit = 1000;
	public static double highwatertrigger = 1000; // triggered for pullbacklevel (min. level)
	public static double highwaterpullback = 40; // max. pullback% allowed from high water before stop trading for the day
	public static double addposition = 400; // add to a position allowed if profit is higher and position is green
	
	// Account stuff
	public static double BuyingPower = 0;
	public static double CashValue = 0;
	public static double RealizedProfitLoss = 0;
	public static double RealizedProfitLossHigh = 0;
	
	// Position stuff
	public static double UnrealizedProfitLossTotal = 0;
	public static double UnrealizedProfitLossES = 0;
	public static double UnrealizedProfitLossYM = 0;
	public static double UnrealizedProfitLossNQ = 0;
	public static double UnrealizedProfitLoss6E = 0;
	public static double UnrealizedProfitLossCL = 0;
	public static double UnrealizedProfitLossGC = 0;
}

namespace NinjaTrader.Indicator
{
    [Description("bTPAMglobals: Think, Plan, Action, Manage... ")]
	// run this indicator somewhere in a chart that is always in the active workspace
    public class bTPAMglobals : Indicator
    {
        #region Variables
        #endregion

        #region Initialize
		protected override void Initialize()
        {
			CalculateOnBarClose = false; 
        }
		#endregion
		
		#region OnBarUpdate
        protected override void OnBarUpdate()
		{
				if (Strategy_bTPAM_Global.RealizedProfitLossHigh < Strategy_bTPAM_Global.RealizedProfitLoss)
				{
					Strategy_bTPAM_Global.RealizedProfitLossHigh = Strategy_bTPAM_Global.RealizedProfitLoss;
				}
				Strategy_bTPAM_Global.UnrealizedProfitLossTotal = Strategy_bTPAM_Global.UnrealizedProfitLossES
				+ Strategy_bTPAM_Global.UnrealizedProfitLossYM + Strategy_bTPAM_Global.UnrealizedProfitLossNQ
				+ Strategy_bTPAM_Global.UnrealizedProfitLoss6E + Strategy_bTPAM_Global.UnrealizedProfitLossCL
				+ Strategy_bTPAM_Global.UnrealizedProfitLossGC;
        }
		#endregion

Reply With Quote
The following 2 users say Thank You to terratec for this post:
 
  #9 (permalink)
Trading Apprentice
Rome, Italy
 
Futures Experience: Advanced
Platform: NinjaTrader
Favorite Futures: Equity Index Futures
 
Posts: 17 since Jul 2010
Thanks: 2 given, 0 received

terratec:

this way sounds good unless you keep your markets/targets/stops unchanged (it looks like some sort of "plan for that day"), but my semi-automated trading is for intraday, so targets and stops must necessarily be manually changed.

Thanks for the idea, I'll keep in mind for future applications.

Reply With Quote
 
  #10 (permalink)
Elite Member
Zurich Switzerland
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: IB
Favorite Futures: ES, 6E, CL
 
Posts: 404 since Sep 2009
Thanks: 64 given, 511 received



maxi View Post
terratec:

this way sounds good unless you keep your markets/targets/stops unchanged (it looks like some sort of "plan for that day"), but my semi-automated trading is for intraday, so targets and stops must necessarily be manually changed.

Thanks for the idea, I'll keep in mind for future applications.

hi maxi

I am a scalper and have to decide very quick for a mini, medium or big scalp, or to add a runner. It is the beauty of that system that let me do this.

In the indicator I just have to press a button for the strategy (mini, medium, big I would like, and one for the quantity. (and order type and place) The system will place the stops and targets according to the instrument (calculated from the baseTicks values in the globals). The baseTick values could be calculated by ATR etc. but I use values fitting to my style for each instrument. This way I dont have to change settings in each indicator etc., just in one file. And I only need one indicator and one strategy for all the instruments, plus that third file.

When trading in ES, I can just switch the instrument in the chart to CL and everything is ready...
Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).

Reply With Quote

Reply



futures io > > > > > Semi-automatic trading

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Using Multicharts on a virtual server for automatic trading arjfca MultiCharts 10 July 2nd, 2013 08:55 AM
What is the best trading platform for automatic strategy? banana Platforms and Indicators 6 December 9th, 2012 01:58 PM
Multicharts & Automatic Trading System Profitable bomberone1 Elite EasyLanguage Automated Trading 8 February 23rd, 2012 01:17 PM
Strategy SEMI AUTOMATED peter88 NinjaTrader Programming 1 January 25th, 2011 01:43 PM


All times are GMT -4. The time now is 11:34 AM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts
Page generated 2017-12-14 in 0.15 seconds with 20 queries on phoenix via your IP 54.227.51.103