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,721 / 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?

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

Thank you @Jura for your help on this! Much appreciated!

Reply With Quote
The following user says Thank You to KhaosTrader for this post:
 
  #52 (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

So...
Within all 10-min bars of a given hour (10:10-11:00), you want to see a trendline showing the High and Low of the previous hour (09:10-10:00).
Correct?

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


Yes that is correct.

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

The way I envision it is that the code will determine how many bars in the given time frame make up an hour, and then it will iterate through the bars to find the highest high and lowest low. That way the hourly code can work in different time scales, be it 1 min, 5 min, 10 min or 15 min...

Reply With Quote
 
  #55 (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

This is not related any more to the initial subject of this thread ("sell this bar").

So I suggest that you post this new request in the thread https://futures.io/elite-circle/11130-want-your-easylanguage-indicator-created-free.html

I also suggest that, in the other thread, you use a brief description as your request. Not too far from:

Quoting 
Within all 10-min bars of a given hour (10:10-11:00), I would like to see a trendline showing the High and Low of the previous hour (09:10-10:00).

Nicolas

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

Ok sounds good. I will make the new post.

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

Hi, I discovered a problem with the current implementation.

It is possible for there to be more than one entry in a given bar, that means that if in a given hourly bar, the code enters a trade and exits the trade at target, and its still moving up, it can enter the trade again. I would like the code to enter trades max 1 time per bar.

Should we add another condition to the if statement below in the code, where it can only execute an entry if price is within a certain range also?

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

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

Another idea might be to identify the current bar time, and make sure it wont enter again on the same bar?

Reply With Quote
 
  #59 (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 the chart where I point out the problem, and the code...

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


(I commented out the short entries because I want to make sure longs work first)

Code:

 
Code
Inputs:
	Target1 (50),
  	Target2(100),
  	Target3(200),
  	StopSize(75),
  	BuyGap(.20),
  	BE2(1) , // 0=false, 1 = true
  	BE3(1); // 0=false, 1 = true
  	
 Variables:
 	EnterLong	( false ),
	LongEntryPrice ( 0 ),
	ShortEntryPrice ( 0 ),
   	TickSize (MinMove/PriceScale),
  	t1 (target1*TickSize),
  	t2 (target2*TickSize),
  	t3 (target3*TickSize),
  	st1 (0),
  	st2 (0),
  	st3 (0);
 

[IntrabarOrderGeneration = true]

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

if MarketPosition = 0 and EnterLong then begin
	Buy ("Enter Long") 300 Shares next Bar at LongEntryPrice stop;
	//SellShort("Enter Short") 300  Shares Next Bar at (ShortEntryPrice) stop;
end;


//Label # Shares below each bar
Value1 = Text_New(Date, Time, Low-(2), NumToStr(CurrentShares/100, 0));
Text_SetColor(Value1, Blue);
Text_SetSize(Value1, 9);


if MarketPosition = 1 then begin

 	st1 = EntryPrice - (stopsize * TickSize);
 	st2 = iff(BE2 = 1, EntryPrice, EntryPrice-(stopsize * TickSize));
 	st3 = iff(BE3 = 1, EntryPrice, EntryPrice-(stopsize * TickSize));

	if CurrentShares = 100 then begin
		Sell("Exit L300-CS100 Target") 100 Shares next Bar at (EntryPrice + t3) Limit;
		Sell("Exit L300-CS100 Stop") 100 Shares next Bar at st3 Stop;
	end;
	
	if CurrentShares = 200 then begin
   		Sell("Exit L200-CS200 Target") 100 Shares Next Bar at (EntryPrice + t2) Limit;
   		Sell("Exit L200-CS200 Stop") 100 Shares Next Bar at st2 Stop;	
   		Sell("Exit L300-CS200 Target") 100 Shares Next Bar at (EntryPrice + t3) Limit;
   		Sell("Exit L300-CS200 Stop") 100 Shares Next Bar at st3 Stop;	
   	end;
   	
   	if CurrentShares = 300 then begin
   		Sell("Exit L100-CS300 Target") 100 Shares Next Bar at (EntryPrice + t1) Limit;
   		Sell("Exit L100-CS300 Stop") 100 Shares Next Bar at st1 Stop;	
   		Sell("Exit L200-CS300 Target") 100 Shares Next Bar at (EntryPrice + t2) Limit;
   		Sell("Exit L200-CS300 Stop") 100 Shares Next Bar at st2 Stop;	
   		Sell("Exit L300-CS300 Target") 100 Shares Next Bar at (EntryPrice + t3) Limit;
   		Sell("Exit L300-CS300 Stop") 100 Shares Next Bar at st3 Stop;
   	end;
	
end;


if MarketPosition = -1 then begin

 	st1 = EntryPrice + (stopsize * TickSize);
 	st2 = iff(BE2 = 1, EntryPrice, EntryPrice+(stopsize * TickSize));
 	st3 = iff(BE3 = 1, EntryPrice, EntryPrice+(stopsize * TickSize));

	if CurrentShares = 100 then begin
		BuyToCover("Exit S300-CS100 Target") 100 Shares next Bar at (EntryPrice - t3) Limit;
		BuyToCover("Exit S300-CS100 Stop") 100 Shares next Bar at st3 Stop;
	end;
	
	if CurrentShares = 200 then begin
   		BuyToCover("Exit S200-CS200 Target") 100 Shares Next Bar at (EntryPrice - t2) Limit;
   		BuyToCover("Exit S200-CS200 Stop") 100 Shares Next Bar at st2 Stop;	
   		BuyToCover("Exit S300-CS200 Target") 100 Shares Next Bar at (EntryPrice - t3) Limit;
   		BuyToCover("Exit S300-CS200 Stop") 100 Shares Next Bar at st3 Stop;	
   	end;
   	
   	if CurrentShares = 300 then begin
   		BuyToCover("Exit S100-CS300 Target") 100 Shares Next Bar at (EntryPrice - t1) Limit;
   		BuyToCover("Exit S100-CS300 Stop") 100 Shares Next Bar at st1 Stop;	
   		BuyToCover("Exit S200-CS300 Target") 100 Shares Next Bar at (EntryPrice - t2) Limit;
   		BuyToCover("Exit S200-CS300 Stop") 100 Shares Next Bar at st2 Stop;	
   		BuyToCover("Exit S300-CS300 Target") 100 Shares Next Bar at (EntryPrice - t3) Limit;
   		BuyToCover("Exit S300-CS300 Stop") 100 Shares Next Bar at st3 Stop;
   	end;
	
end;

Reply With Quote
 
  #60 (permalink)
Trading for Fun
London
 
Futures Experience: None
Platform: mc, TS, ninja
Favorite Futures: es
 
Bimi's Avatar
 
Posts: 118 since Mar 2010
Thanks: 42 given, 58 received


you need to create a time-line, and step your code through the time-line to make sure all the angles are covered.

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 08:49 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-16 in 0.12 seconds with 20 queries on phoenix via your IP 54.160.245.121