Problem with a High formula set - NinjaTrader Programming | futures io social day trading
futures io futures trading


Problem with a High formula set
Updated: Views / Replies:416 / 5
Created: by olres7 Attachments:1

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
 
Thread Tools Search this Thread
 

Problem with a High formula set

  #1 (permalink)
Elite Member
Gatlinburg TN/USA
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: Futures
 
Posts: 12 since Sep 2015
Thanks: 5 given, 0 received

Problem with a High formula set

I want to go short when the previous High[1] more than 21 Highs in a row and the range between previous High[1] and Low[1] less than 2 points

I tried many times, however all the time I have an error.

if( High[1] > High[2] ...High[21] && High[1]-Low[1]<2)
{
EnterShortLimit(GetCurrentBid(), "Short");
Print(Time[0]+" Sell");
}

Or I tried this way:

if( High[1]>High[2] &&
High[1]>High[3] &&
High[1]>High[4] &&
High[1]>High[5] &&
...
High[1]>High[21] &&
High[1] - Low[1] <2
{
EnterShortLimit(GetCurrentBid(), "Short");
Print(Time[0]+" Sell");
}

On second example it complies correct however it doesn't give me correct results. It doesn't go short when the previous high higher than 21 highs and the range lower than 2 points

Please help me to fix this issue
My code idea is this:

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
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,651 since Mar 2010
Thanks: 4,226 given, 25,597 received
Forum Reputation: Legendary


It is not possible to deal with the question, as the information that you have give is not sufficient.

Please show the entire code section for OnBarUpdate(), otherwise the bugs cannot be identified.

Further it is crucial to understand, whether you plan to run your strategy with CalculateOnBarClose set to "True" of "False".

Reply With Quote
The following user says Thank You to Fat Tails for this post:
 
  #4 (permalink)
Elite Member
Gatlinburg TN/USA
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: Futures
 
Posts: 12 since Sep 2015
Thanks: 5 given, 0 received

Reply

protected override void Initialize()
{
CalculateOnBarClose = true;
SetStopLoss("", CalculationMode.Ticks, 4, false);
SetProfitTarget("", CalculationMode.Ticks, 15);

}

protected override void OnBarUpdate()
{

if(

//First Condition - Previous High[1] Higher than 21 highs
High[1]>High[2] &&
High[1]>High[3] &&
High[1]>High[4] &&
High[1]>High[5] &&
High[1]>High[6] &&
High[1]>High[7] &&
High[1]>High[8] &&
High[1]>High[9] &&
High[1]>High[10] &&
High[1]>High[11] &&
High[1]>High[12] &&
High[1]>High[13] &&
High[1]>High[14] &&
High[1]>High[15] &&
High[1]>High[16] &&
High[1]>High[17] &&
High[1]>High[18] &&
High[1]>High[19] &&
High[1]>High[20] &&
High[1]>High[21] &&

//Second Condition - Difference between previous High[1] - Low[1] <2 points
High[1] - Low[1] <2)
{
// Go short when 2 conditoins are true
EnterShortLimit(GetCurrentBid(), "Short");
Print(Time[0]+" Sell");
}

}//End OnBarUpdate

Even it complies correct however it doesn't give me correct results. It doesn't go short when the previous high higher than 21 highs and the difference between high and low lower than 2 points.

It go short on a completely wrong price
Please help me to fix this issue


Last edited by olres7; September 13th, 2015 at 03:00 PM.
Reply With Quote
 
  #5 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,651 since Mar 2010
Thanks: 4,226 given, 25,597 received
Forum Reputation: Legendary

This script should not run, as for bars smaller than 20 (CurrentBar < 20), it will produce a runtime error.

What do you call a point? Which instrument did you apply it to?


Also you can simplify the code to

 
Code
if(CurrentBar < 21)
     return;

if(High[1] > MAX(High, 20)[2] && Range()[1] > 2)
     EnterShortLimit(GetCurrentBid(), "Short");

Reply With Quote
The following 2 users say Thank You to Fat Tails for this post:
 
  #6 (permalink)
Elite Member
Gatlinburg TN/USA
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: Futures
 
Posts: 12 since Sep 2015
Thanks: 5 given, 0 received

Daily Stop Loss ISSUE

Hi!

I am writing my own strategy. It is almost done.
However the last thing I have left is a daily loss limit.
I have the example of it.
However even it is complies good and doesn't have any mistakes it still works with wrong results

It works great with 1 Order - IOrder (shortOrder1)
Daily STOP LOSS = 200

However if I have 2 orders 2 IOrder (shortOrder1 and shortOrder2)
It will automatically make this command for each order

shortOrder1 = 200 daily loss
shortOrder2 = 200 daily loss

So total my loss will be 400

I want total of these orders do not go over 200

IF <DAILY STOP LOSS OVER 200> THEN <STOP TRADING>

(shortOrder1 + shortOrder1) <= 200 Stop Loss

I tried many times different things and they didn't work

I trade for today - 11/02/2015
I had a HUGE LOSS THIS DAY and my DAILY LOSS LIMIT didn't help me
My strategy works on a 5 Min interval

How can I do that in order total orders do not go over 200 daily loss?

Pls help me to figure out that issue.

SCRIPT FILE ATTACHED

Thanks,
Serge

Attached Files
Register to download File Type: txt DailyLossLimit.txt (5.5 KB, 4 views)
Reply With Quote

Reply



futures io > > > > > Problem with a High formula set

Thread Tools Search this Thread
Search this Thread:

Advanced Search



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

Linda Bradford Raschke: Reading The Tape

Elite only

Adam Grimes: TBA

Elite only

NinjaTrader: TBA

January

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Formula 1 JohnnyAustin Off-Topic 73 April 15th, 2015 08:08 PM
Strategy help: Trying to have entry, set stop loss, and set target on the next bar turboscottomatic EasyLanguage Programming 2 January 22nd, 2015 07:46 AM
Any Ideas of how I get High Low of a Range set by an Indicator bundwidower NinjaTrader 3 February 10th, 2014 09:21 AM
How to set up a computer array for high volume trading? Mashu01 Traders Hideout 10 December 11th, 2012 04:57 AM
Cannot use decimal in RSI formula sqadri NinjaTrader Programming 3 October 22nd, 2011 10:01 AM


All times are GMT -4. The time now is 07:42 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-11 in 0.14 seconds with 20 queries on phoenix via your IP 54.226.132.197