sell this bar, not next bar, is that possible? - EasyLanguage Programming | futures io social day trading
futures io futures trading


sell this bar, not next bar, is that possible?
Updated: Views / Replies:10,699 / 68
Created: by KhaosTrader Attachments:17

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

sell this bar, not next bar, is that possible?

  #41 (permalink)
Elite Member
San Jose
 
Futures Experience: Intermediate
Platform: NinjaTrader, Esignal
Favorite Futures: Stocks
 
Posts: 107 since Jan 2012
Thanks: 40 given, 21 received

sorry... the phrase "I used 1 dollar hardcoded for entrypice and exit price, since i am trading aapl."

should be " i used 1 dollar hardcoded from entry price for both stop and target since i am trading aapl"

Reply With Quote
 
  #42 (permalink)
Elite Member
San Jose
 
Futures Experience: Intermediate
Platform: NinjaTrader, Esignal
Favorite Futures: Stocks
 
Posts: 107 since Jan 2012
Thanks: 40 given, 21 received

Here is a 1 minute chart that shows the problem.

Also I fixed up the print share size logic so it looks nicer on the chart, I also divided the share size by 3 so it shows it as one numeric digit...




 
Code
  variables:
  	TickSize (MinMove/PriceScale);
	
  	

  [IntrabarOrderGeneration = true]
  	
  	
 // open new positions


if (MarketPosition = 0 and barstatus(1) = 2  and Low >= Low[1] and High >= High[1]) then begin
	Buy ("Enter Long") 300 Shares Next Bar At high stop;
 end;
 

 
 Value1 = Text_New(Date, Time, Low-(5*TickSize), NumToStr(CurrentShares/100, 0));
 Text_SetColor(Value1, Blue);
Text_SetSize(Value1, 9);
 
 // manage open orders
 
 if MarketPosition = 1 then begin
   		Sell("Profit Target") 300 Shares Next Bar at (EntryPrice + 1) Limit;
   		Sell("Stop Loss") 300  Shares Next Bar at (EntryPrice-1) Stop;	
   	end;


Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).

Reply With Quote
 
  #43 (permalink)
Elite Member
near Paris, France
 
Futures Experience: Beginner
Platform: -
Favorite Futures: -
 
Nicolas11's Avatar
 
Posts: 1,070 since Aug 2011
Thanks: 2,232 given, 1,729 received


@KhaosTrader,

First, I managed to reproduce your problem, on the same chart (AAPL 1min July 26th, 2012).

From @Jura's post above, I understand that, when [IntrabarOrderGeneration = true], "at next bar" means "at next tick".
So the strategy was entering "at next bar" (in the common sense) only if the first tick of the next bar was above the High of the current one.
But you want to enter at any tick within "next bar" provided that this tick is above the High of the current one.

So you have to use @Jura's idea.
I have integrated it into our small code. See below. It seems to work. See picture.

I have learnt something. Thanks @Jura !

Nicolas

 
Code
Variables:
	TickSize	( MinMove / PriceScale ),
	enterlong	( false );

[IntrabarOrderGeneration = true]

if ( BarStatus(1) = 2 ) then begin 
	enterLong = ( Low >= Low[1] and High >= High[1] );
end;

if MarketPosition = 0 and enterlong then begin
	Buy ("Enter Long") 300 Shares Next Bar At high stop;
end;

if MarketPosition = 1 then begin
	Sell("Profit Target") 300 Shares next Bar at (EntryPrice + 1) Limit;
	Sell("Stop Loss") 300 Shares next Bar at (EntryPrice - 1) Stop;
end;
Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).


Last edited by Nicolas11; August 20th, 2012 at 03:44 AM.
Reply With Quote
The following user says Thank You to Nicolas11 for this post:
 
  #44 (permalink)
Elite Member
near Paris, France
 
Futures Experience: Beginner
Platform: -
Favorite Futures: -
 
Nicolas11's Avatar
 
Posts: 1,070 since Aug 2011
Thanks: 2,232 given, 1,729 received

Actually, there is still something to be fixed in "at High stop". Should be "High or High[1]".

EDIT: in the below picture, the entry circled in blue shoud not exist.
Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).


More on this in the next message.

Reply With Quote
 
  #45 (permalink)
Elite Member
near Paris, France
 
Futures Experience: Beginner
Platform: -
Favorite Futures: -
 
Nicolas11's Avatar
 
Posts: 1,070 since Aug 2011
Thanks: 2,232 given, 1,729 received

In the last code, we have:
 
Code
if MarketPosition = 0 and enterlong then begin
	Buy ("Enter Long") 300 Shares Next Bar at High stop;
end;
"at High stop" is correct when the above 3-line block of code is read on the last tick of the current bar.
But if these lines are read at a tick within the next bar (supposed to be the entry bar), should be "at High[1] stop".

I think that it could be corrected as follows:
 
Code
Variables:
	TickSize	( MinMove / PriceScale ),
	EnterLong	( false ),
	PriceForEntry ( 0 );

[IntrabarOrderGeneration = true]

if ( BarStatus(1) = 2 ) then begin 
	EnterLong = ( Low >= Low[1] and High >= High[1] );
	PriceForEntry = High;
end;

if MarketPosition = 0 and EnterLong then begin
	Buy ("Enter Long") 300 Shares next Bar at PriceForEntry stop;
end;

if MarketPosition = 1 then begin
	Sell("Profit Target") 300 Shares next Bar at (EntryPrice + 1) Limit;
	Sell("Stop Loss") 300 Shares next Bar at (EntryPrice - 1) Stop;
end;
Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).

Reply With Quote
The following 2 users say Thank You to Nicolas11 for this post:
 
  #46 (permalink)
Elite Member
San Jose
 
Futures Experience: Intermediate
Platform: NinjaTrader, Esignal
Favorite Futures: Stocks
 
Posts: 107 since Jan 2012
Thanks: 40 given, 21 received

Nicolas,

Yes that is correct. It works now... You are correct that we need to store the PriceForEntry in a variable.... Thanks so much!


Because I would like to make sophisticated stops, it would be good to use a lower time frame chart, but use a higher time frame data for entries.

Yesterday I spoke of creating a high and a low for the complete hour and drawing a trendline on the chart for each next hour.. So if during 10am to 11am the highest tick was 610.20 and the lowest tick was 605.80 then we would have horizontal trendlines from 11am to 12am at 610.20 and 605.80. This would be a visual cue , but in fact the strategy would enter a trade long if it price broke above 610.20 and would enter short if it broke below 605.80. Then I can use the smaller time frame bars in the chart to manage the exit (do a trailing stop if i am in a long trade and it breaks the highest low of the last 2 bars or something).

Actually the existing strategy would look at the trendlines of the last 2 hours, to see if trendlines are higher high and lower low, and then if so , if the next hour breaks the high it enters long...

If you have time to code something like that, I would really appreciate it.

Reply With Quote
 
  #47 (permalink)
Elite Member
near Paris, France
 
Futures Experience: Beginner
Platform: -
Favorite Futures: -
 
Nicolas11's Avatar
 
Posts: 1,070 since Aug 2011
Thanks: 2,232 given, 1,729 received

@KhaosTrader,

1. You're welcome, but your thanks shall also be directed to @Jura: he solved the most difficult part.

2. Even if it is possible, I think that there is no need to use 2 timeframes to manage your strategy. With [intrabarordergeneration = true], you can manage what happens at all ticks in the bar.

3. "the strategy would enter a trade long if it price broke above 610.20 and would enter short if it broke below 605.80"
Do you mean that the strategy would enter long at any bar on a breakout (up) of last bar's High?
If yes, you can very easily adapt the above code. I do not see the problem.

4. Trendlines --> I first need to understand 3.

Nicolas

Reply With Quote
The following user says Thank You to Nicolas11 for this post:
 
  #48 (permalink)
Elite Member
San Jose
 
Futures Experience: Intermediate
Platform: NinjaTrader, Esignal
Favorite Futures: Stocks
 
Posts: 107 since Jan 2012
Thanks: 40 given, 21 received

Nicolas,

Ok, lets do a walkthrough example:

9am to 10am Highest high was 505.20 Lowest Low was 502.30
10am to 11am Highest high was 506.20 Lowest Low was 503.50

Therefore, if we were in hourly chart we would see that the last bar offered a higher high and a higher low.

So if during the next hour, price rose above 503.20 we would enter long.

The reason why I would like to have lower time frame bars is because by looking at how bars are painted I can do more sophisticated stops. For example if i had 300 shares long, after it hit target 1, then i can implement an trailing stop where I would look at the last 3 five minute bars and if price fell below the lowest low of the last 3 bars then it would stop me out of the trade.

Therefore, I use the hourly highest high and lowest lows to determine if the trade is qualified to go long, and at what price, then I can use a lower time frame bar (for example, 5 minute bars) to implement a more agile and sophisticated stop strategy.

Reply With Quote
 
  #49 (permalink)
Elite Member
near Paris, France
 
Futures Experience: Beginner
Platform: -
Favorite Futures: -
 
Nicolas11's Avatar
 
Posts: 1,070 since Aug 2011
Thanks: 2,232 given, 1,729 received

"9am to 10am Highest high was 505.20"

What does "Highest High" mean?
The High of this 1-hour bar?

Reply With Quote
 
  #50 (permalink)
Elite Member
San Jose
 
Futures Experience: Intermediate
Platform: NinjaTrader, Esignal
Favorite Futures: Stocks
 
Posts: 107 since Jan 2012
Thanks: 40 given, 21 received


Since we are using a 10 minute chart, it would look at the 6 bars from 9am to 10am and look for the highest and lowest price that the bars touched during that time.

9:10 Bar: High=500.10 Low = 500.00
9:20 Bar: High=500.50 Low = 498.10
9:30 Bar: High=502.10 Low = 500.10
9:40 Bar: High=501.10 Low = 499.22
9:50 Bar: High=505.20 Low = 500.20
10:00 Bar: High=505.20 Low = 501.20

The highest high = 505.20 and the Lowest low is 498.10 for the hour.

so then we would draw two horizontal trendlines (one at 505.20 and one at 498.10) that would span into the future from 10:10 to 11:00


Last edited by KhaosTrader; August 20th, 2012 at 04:32 AM. Reason: typo
Reply With Quote

Reply



futures io > > > > > sell this bar, not next bar, is that possible?

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
Book Discussion: Reading Price Charts Bar by Bar by Al Brooks cunparis Traders Hideout 530 October 19th, 2016 08:45 PM
Webinar: Dr. Gary Dayton Reading the Market Bar-by-Bar Big Mike The Elite Circle 37 August 28th, 2013 08:02 AM
Outside Bar buy or sell ness1g NinjaTrader 7 March 7th, 2012 07:18 PM
End of bar strategies with advanced bar types (Renko, Range, Kagi, etc) RM99 Elite EasyLanguage Automated Trading 2 September 9th, 2011 09:38 AM
Image:al brooks reading price charts bar by bar.jpg Big Mike Trading Wiki Images 0 July 1st, 2010 09:00 PM


All times are GMT -4. The time now is 09:37 PM.

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-15 in 0.13 seconds with 20 queries on phoenix via your IP 54.91.171.137