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

  #61 (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

@Bimi, could you kindly elaborate a little? Sounds interesting but I have not caught it.

@KhaosTrader, you can use a flag. For instance a boolean AlreadyTradedThisBar that you would set to false at each new bar (BarStatus).

Nicolas

Envoyé depuis mon GT-I9100 avec Tapatalk

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

I implemented your suggestion by setting the flag, EnterTrade = false.. But now it wont enter all trades it should.. Here is the screenshot....

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


here is the code snippet..

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

if MarketPosition = 0 and EnterTrade then begin
	Buy ("Enter Long") 300 Shares next Bar at LongEntryPrice stop;
	EnterTrade = false;
	//SellShort("Enter Short") 300  Shares Next Bar at (ShortEntryPrice) stop;
end;
Here is full 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:
 	EnterTrade 	( 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 
	EnterTrade = ( Low >= Low[1] and High >= High[1] );
	LongEntryPrice = High;
	ShortEntryPrice = Low;
end;

if MarketPosition = 0 and EnterTrade then begin
	Buy ("Enter Long") 300 Shares next Bar at LongEntryPrice stop;
	EnterTrade = false;
	//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
 
  #63 (permalink)
Elite Member
San Jose
 
Futures Experience: Intermediate
Platform: NinjaTrader, Esignal
Favorite Futures: Stocks
 
Posts: 107 since Jan 2012
Thanks: 40 given, 21 received


Oh on the Strategy, I set the following:

* Allow unlimited entries per bar

* Backtesting Precision : Use Bar Magnifier [checked], Intraday=1 minutes, Skip ticks with identical prices [checked]

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

Seems logical...

I copy your code:

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

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

Let's suppose that, at the last tick of the bar (BarStatus = 2), EnterTrade is set to true (first part of the code)
With the 2nd part of the code, you ask to buy at the next tick (first tick of the next bar) at a given price.
But you also set EnterTrade to false.
So, if the given price is not reached on the first tick of the next bar, the code will not enter trade later within the bar.

Nicolas

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

I see your point....

I then moved the "EnterTrade = false;" to the "if marketposition =1 then begin...

 
Code
if MarketPosition = 1 then begin
	EnterTrade = false;
 	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;
but now again, it enters multiple times each bar... So I am pretty much at a loss on what to do...

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

Could you test the 2 following modifications?

(1) In the Variables declaration, add one intrabarpersist:
 
Code
intrabarpersist EnterLong	( false ),
(2) At the beginning of "if MarketPosition = 1", add one line:
 
Code
if MarketPosition = 1 then begin
   EnterLong = false;
   [...]

--> Seems OK on my side (one entry per bar).

If it "doesn't work" on your side, please post again the whole code and a snapshot showing the problem.

I have to be frank: due to time constraints, I am not sure I will be able to continue here.

Nicolas


Last edited by Nicolas11; August 22nd, 2012 at 06:36 AM.
Reply With Quote
The following 2 users say Thank You to Nicolas11 for this post:
 
  #67 (permalink)
Elite Member
San Jose
 
Futures Experience: Intermediate
Platform: NinjaTrader, Esignal
Favorite Futures: Stocks
 
Posts: 107 since Jan 2012
Thanks: 40 given, 21 received

I think its working

I will test it more...

How did you discover the intrabarpersist ?

Thanks Nicolas!

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

I'm happy it seems to work.

"How did you discover the intrabarpersist ?"
It is a secret.

Nicolas

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

LOL well, you are really good at easylanguage, I doubt I would have found that.

Thanks

Reply With Quote
The following user says Thank You to KhaosTrader for this post:

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)

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
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:41 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-10 in 0.11 seconds with 20 queries on phoenix via your IP 54.83.122.227