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

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

What it would do is create a high and a low horizontal trendline for the next hour... and it would keep doing that moving forward

so each prior rounder prior hour would have a high and a low price, and then it would create a trend line for the next hour's worth of bars so u can see if it is breaking the high or the low of the prior hour.. That way I would have the power of using hour bars to determine entry prices and i can use 1 minute bars to determine exit strategy.

Reply With Quote
 
  #32 (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. The 1-min workaround is another story. I think that we first need to solve what happens with the 1-hour bar.

2. "I cant decipher the time". I do not understand. Could you show me an example of what is printed?
On my side, it is rather clear:

Quoting 
At 1120817 1600 CurrentShares = 300.00

3. "Is it possible to put the # of shares held Below the bar itself?"
Yes.
 
Code
Value1 = Text_New(Date, Time, Low-TickSize, NumToStr(CurrentShares, 0));
EDIT: This works for MultiCharts. I do not know for TradeStation.

4. "I need the " BarStatus(1) = 2" because I want to enter on the next bar on the break of the prior bar high..."
I am lost.
In the first message, I have the feeling that you wanted exactly the contrary: enter within a bar.
If you want to enter right at the opening of the next bar when a condition is met, you shall not use [intrabarordergeneration = true]
Please clarify.

Nicolas


Last edited by Nicolas11; August 19th, 2012 at 03:14 PM. Reason: addition (visible)
Reply With Quote
 
  #33 (permalink)
Elite Member
San Jose
 
Futures Experience: Intermediate
Platform: NinjaTrader, Esignal
Favorite Futures: Stocks
 
Posts: 107 since Jan 2012
Thanks: 40 given, 21 received


1) ok I understand

2) 1120817 , how is this translated into time?

3) ok i put that in the code, and i have enclosed screenshot

4) i want to enter in the next bar, once it breaks the high of the prior bar , but I want to be able to exit if my target is met on the same bar that I entered....

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

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

ah the date format i get now.. 1120817 1600 , 1600 is the hour, and the other part is the date, got it

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

For the date, do not forget that 112 means 2012 in Easy Language (add 1900).

The text printing on the chart is OK. We see the "0". When the trade lasts on several bars, you should see 300, 200, 100. If you want to change the color or the size:
 
Code
Value1 = Text_New(Date, Time, Low-TickSize, NumToStr(CurrentShares, 0));
Text_SetColor(Value1, blue);
Text_SetSize(Value1, 14);
I have to make a break. I will come back later.

Reply With Quote
The following user says Thank You to Nicolas11 for this post:
 
  #36 (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 thanks Nicolas, I am here whenever you are ready .

Thanks again for your help

Reply With Quote
 
  #37 (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 confirm your condition to enter long ? Is it what follows?

If "Low >= Low[1] and High >= High[1]" then enter at any moment within the next bar when the price reaches the High of the current bar.

Nicolas

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

If I have correctly understood what you are trying to do, this is not straight-forward.
I have myself struggled with it for a long time.
So thanks for your question, since it allows me clarifying things in my mind.
But the negative side is... I may be wrong!

You want the exits (stop-loss or profit target) to possibly occur on the same bar as the entry.
I think this requires [intrabarordergeneration = true].

But [IntrabarOrderGeneration = true] has a negative side effect: the condition for the entry is checked at any moment within the current bar. But you want the condition to be checked only at bar close. So there is your BarStatus = 2.

So... I'm OK with your code.

It remains that you have some problem.

I advise that you simplify your code to the simplest. For me, the simplest form is 10 lines:
 
Code
Variables:
	TickSize	( MinMove / PriceScale );

[IntrabarOrderGeneration = true]

if MarketPosition = 0 and BarStatus = 2 and Low >= Low[1] and High >= High[1] 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 + 0.0003) Limit;
	Sell("Stop Loss") 300 Shares next Bar at (EntryPrice - 0.0003) Stop;
end;
Does it work? If yes, add the sophistications one by one until the problem appears.

Nicolas

Reply With Quote
The following user says Thank You to Nicolas11 for this post:
 
  #39 (permalink)
 Vendor: tradingcode.net 
The Netherlands
 
Futures Experience: None
Platform: MultiCharts, TradingView
Favorite Futures: ...
 
Jura's Avatar
 
Posts: 774 since Apr 2010
Thanks: 2,347 given, 661 received


Nicolas11 View Post
If I have correctly understood what you are trying to do, this is not straight-forward.
I have myself struggled with it for a long time.
So thanks for your question, since it allows me clarifying things in my mind.
But the negative side is... I may be wrong!

You want the exits (stop-loss or profit target) to possibly occur on the same bar as the entry.
I think this requires [intrabarordergeneration = true].

But [IntrabarOrderGeneration = true] has a negative side effect: the condition for the entry is checked at any moment within the current bar. But you want the condition to be checked only at bar close. So there is your BarStatus = 2.

I think you're right.

If one uses BarStatus = 2 with 'buy next bar', the order will be executed on the first tick of the next bar (assuming it's a market order, otherwise it will be cancelled). With IntrabarOrderGeneration set on, the stop-loss for the same bar can be send on the second tick of the bar.

I can't say I understand the whole thread, but if I understand it correctly the enter stop orders need to be submitted for the whole duration of the next bar? If so, you'll need to use a true/false value to keep continue submitting the stop order for the next bar.

Because with IntrabarOrderGeneration next bar actually means next tick, the enter stop needs to be resubmitted. Otherwise, if the enter stop conditions aren't triggered on the first tick of the next bar, the order is cancelled.

Such a thing could look like:

 
Code
[intrabarordergeneration = true]

// On bar close
if (BarStatus(1) = 2) then begin 

	// Calculate long/short entries
	enterLong = ... 
	enterShort = ...
	
	// Calculate stop here (if needed)
	stop1 = ...
	
end;


// On every tick, submit entry stop
if (MarketPosition = 0) then begin

	if (enterLong = true) then
		// submit order for next bar (= next tick)
			
	if (enterShort = true) then 
		// submit order for next bar
	
end;
	
// Manage stop-losses
if (MarketPosition = 1) then begin

	// Submit Long stop here

end

else if (MarketPosition = -1) then begin 

	// Submit Short stop here

end;


Last edited by Jura; August 19th, 2012 at 05:24 PM.
Reply With Quote
The following 3 users say Thank You to Jura for this post:
 
  #40 (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,

I implemented the code you are suggesting.. I agree its a good idea to make it as simple as possible to figure out the problem.

Here is the chart with circled red where it should have entered on the bars with red underlines in the circle, code is below also...

I am showing with 5 min bar charts and 60 Min bar chart

5 MIN BARS

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



60 MIN BARS

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




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





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-TickSize, NumToStr(CurrentShares, 0));

// 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;

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 11:31 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-17 in 0.14 seconds with 20 queries on phoenix via your IP 54.221.73.186