Thanks and regards.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
simple strategy
Collapse
X
-
simple strategy
Good morning, like to me a very simple strategy, I just want to open me to a particular 8.00am for example a purchase price 5 ticks with a stop loss and take profit time, they could give me some idea?
Thanks and regards.Tags: None
-
Mainly it is just that. I want to open a buy limit to 5 or 10 ticks above where the price and at a specific time, ie at 8am, 8:30 a.m., etc ...
Thanks.
Comment
-
Hello,
You could create a check using the ToTime() method to compare when the Time of the Current Bar is equal to 8:00AM. Within that check you would create an action to submit the order. You would not be able to submit a buy limit order above the market price however you could submit a stop order above the market price.
I have provided an example of how you could do this below:
Code:protected override void OnBarUpdate() { if(ToTime(Time[0]) == ToTime(8, 0, 0)) EnterLongStop(Close[0] + 5 * TickSize); }
Please let us know if you have any further questions.Cody B.NinjaTrader Customer Service
Comment
-
Ok thank you very much, give me only needed to choose when I want, ie 8:30 a.m., 8:44 a.m., 9:02 a.m., etc, also you can also choose it to 5 ticks price, 6, 7 or 10 ticks, etc., above the price.
Thanks again.Last edited by punkiy2111; 06-19-2016, 03:30 PM.
Comment
-
Excuse me, you could tell me how to do to put any hour, ie 8h, 8.33h, etc. And also ticks the distance in which I want to rise above the price? I want to change the parameters of the strategy at the time and distance I choose.
Thank you.
Originally posted by punkiy2111 View PostOk thank you very much, give me only needed to choose when I want, ie 8:30 a.m., 8:44 a.m., 9:02 a.m., etc, also you can also choose it to 5 ticks price, 6, 7 or 10 ticks, etc., above the price.
Thanks again.
Comment
-
Hello,
The ToTime(8, 0 , 0) portion of the example is where you would enter the time. This translates to 8:00:00AM. If you wanted to do 8:33AM you would use ToTime(8, 0, 0).
The portion of the example that shows how you can do 5 ticks above the closing price is within the order entry method Close[0] + 5 * TickSize. If you wanted to do 6 ticks above you would do Close[0] + 6 * TickSeze.
If you have any further questions please let us know.Cody B.NinjaTrader Customer Service
Comment
-
Hello again, I managed to make it work me but I will not open orders at the exact time and execute commands before, if for example I want to open my order at 22:45:15 as it should place the code?
Thanks again.
Comment
-
Ok, and if what I want is to change the time from the parameters to change the time in a more comfortable way? as it should be done? I send you a screenshot. Thanks and regards.
QUOTE=NinjaTrader_CodyB;464352]Hello,
The ToTime(8, 0 , 0) portion of the example is where you would enter the time. This translates to 8:00:00AM. If you wanted to do 8:33AM you would use ToTime(8, 0, 0).
The portion of the example that shows how you can do 5 ticks above the closing price is within the order entry method Close[0] + 5 * TickSize. If you wanted to do 6 ticks above you would do Close[0] + 6 * TickSeze.
If you have any further questions please let us know.[/QUOTE]
Comment
-
Hello,
You can achieve what you are seeing in that screenshot by using a public TimeSpan variable. I have provided an example below of how you could use TimeSpan.
Code:protected override void Initialize() { MyTimeSpan = new TimeSpan(8, 0, 0); CalculateOnBarClose = true; } protected override void OnBarUpdate() { if(Time[0].TimeOfDay == MyTimeSpan) { Print(MyTimeSpan.ToString()); EnterLong(); } } #region Properties [XmlIgnore()] [Description("TimeSpan")] [GridCategory("Parameters")] public TimeSpan MyTimeSpan {get; set;} [Browsable(false)] public string MyTimeSpanSerialize { get { return MyTimeSpan.ToString(); } set { MyTimeSpan = TimeSpan.Parse(value); } }
Cody B.NinjaTrader Customer Service
Comment
-
Ok thanks, but I think perhaps I have not explained well. It is the same as is in Spain or London, what I mean is to manipulate time through the parameters of the strategy. I want to put an hour without having to edit the strategy in the same way that I can easily touch the stop loss or take profit.
Thank you.
Comment
-
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by fx.practic, 10-15-2013, 12:53 AM
|
5 responses
5,403 views
0 likes
|
Last Post
by Bidder
Today, 12:22 AM
|
||
Started by Shai Samuel, 07-02-2022, 02:46 PM
|
4 responses
94 views
0 likes
|
Last Post
by Bidder
Today, 12:11 AM
|
||
Started by DJ888, Yesterday, 10:57 PM
|
0 responses
6 views
0 likes
|
Last Post
by DJ888
Yesterday, 10:57 PM
|
||
Started by MacDad, 02-25-2024, 11:48 PM
|
7 responses
158 views
0 likes
|
Last Post Yesterday, 10:23 PM | ||
Started by Belfortbucks, Yesterday, 09:29 PM
|
0 responses
8 views
0 likes
|
Last Post
by Belfortbucks
Yesterday, 09:29 PM
|
Comment