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

  #21 (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 put the command : print ("ticksize = " + numtoStr(TickSize,2));

gives me:
ticksize = 0.01

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

OK.
And what is the value of StopSize?
Not the one in your code.
But the one in the inputs of the strategy in MultiCharts "Format Signal".

Reply With Quote
 
  #23 (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 are the values
Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).

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

Looks OK.
I cannot reproduce your problem on my computer, so it is difficult for me to help you.
I suggest that you replace all "at st1", "at st2" and "at st3" by "at EntryPrice-0.75" for long and "at EntryPrice+0.75" for long.
If it works, try to put again your current code, but step by step:
Begin with "at EntryPrice-75*TickSize"
Then more and more sophisticated until you understand at which step the problem appear.

Reply With Quote
The following 2 users say Thank You to Nicolas11 for this post:
 
  #25 (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 will do what you are suggesting, thanks again for your great help Nicolas

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

it looks like the stop is not getting triggered, check this out... if i expand the chart..
Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).

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

Please post the code. Otherwise, how could we analyze?

Reply With Quote
The following user says Thank You to Nicolas11 for this post:
 
  #28 (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 hardcoded stops, and here is the code, and it should have entered in the circle area but it didnt

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



code:


inputs:
target1 (50),
target2(100),
target3(300),
stopsize(75),
buyCushion (.20),
BE2(0) , // 0=false, 1 = true
BE3(0); // 0=false, 1 = true

vars:
TickSize (MinMove/PriceScale),
smav (0),
emav (0),
hmav(0),
t1 (target1*TickSize),
t2 (target2*TickSize),
t3 (target3*TickSize),
st1 (1),
st2 (1),
st3 (1),
buyTrigger(0);


[IntrabarOrderGeneration = true]


// open new positions


if MarketPosition = 0 and barstatus(1) = 2 and Low >= Low[1] and High >= High[1] then begin
//and time>1000 and (time <1600)
//Print("This is the closing tick of the bar.");
// print ("this is buyTrigger = "+ NumToStr(buyTrigger ,0));
// print ("timea = " + NumToStr(Time,0));

print ("ticksize = " + numtoStr(TickSize,2));

//Buy ("Enter Long") 300 Shares Next Bar At (High+buypoint) stop;
Buy ("Enter Long") 300 Shares Next Bar At high stop;

//SellShort("Enter Short") 300 Shares Next Bar at (Low-buypoint) stop;




end;





// manage open orders

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

//print ("this is ticksize = "+ NumToStr(ticksize ,2));
//print ("this is enter = "+ NumToStr(entryprice ,2));
// print ("this is stop = "+ NumToStr(st1 ,2));
// print ("this is stopsize = "+ NumToStr(stopsize ,2));
//
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 (EntryPrice-1) 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 (EntryPrice-1) Stop;
Sell("Exit L300-CS200 Target") 100 Shares Next Bar at (EntryPrice + t3) Limit;
Sell("Exit L300-CS200 Stop") 100 Shares Next Bar at (EntryPrice-1) Stop;
end;

if CurrentShares = 300 then begin

print ("*********barstatus at exit commands = " + NumToStr(barstatus(1),0));

Sell("Exit L100-CS300 Target") 100 Shares Next Bar at (EntryPrice + t1) Limit;
Sell("Exit L100-CS300 Stop") 100 Shares Next Bar at (EntryPrice-1) Stop;
Sell("Exit L200-CS300 Target") 100 Shares Next Bar at (EntryPrice + t2) Limit;
Sell("Exit L200-CS300 Stop") 100 Shares Next Bar at (EntryPrice-1) Stop;
Sell("Exit L300-CS300 Target") 100 Shares Next Bar at (EntryPrice + t3) Limit;
Sell("Exit L300-CS300 Stop") 100 Shares Next Bar at (EntryPrice-1) 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
 
  #29 (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

Please use the [ CODE] tags around your code next time.

I still cannot reproduce the problem on my side.

And the problem seems to evolve on your side.
On your last screenshot, the problem does not seem linked to stops, since the last trade was correctly stopped. And you were flat afterwards.
This time, the issue seems that the strategy does not enter trade whereas it is supposed to.

Could you:
1. print the time and the value of CurrentShares at each candle in order to check that you are flat when you are supposed to be flat?
 
Code
print(Date:8:0," ", Time:4:0, " --> CurrentShares = ", CurrentShares);
2. delete "and BarStatus(1) = 2"

Any improvement?

Nicolas

Reply With Quote
The following user says Thank You to Nicolas11 for this post:
 
  #30 (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 need the " BarStatus(1) = 2" because I want to enter on the next bar on the break of the prior bar high...

I entered the
print(Date:8:0," ", Time:4:0, " --> CurrentShares = ", CurrentShares);

But I cant decipher the time, is it possible to put the # of shares held Below the bar itself?

Another approach to this whole thing would be to use a 1 minute chart, then what I would do is somehow get the high and the low of the rounded last hour bar... Then if it breaks above that in the next hour it would be a long. That would be the best way.

So that way, I would do the following: I would need a function that would get me the highest high and lowest low of the stock during the rounded hour timeframe: 10:00am to 10:59am , 11:00am to 11:59 am. then I can enter on next bar, and do a lot more elegant stop strategies... Do you know how i can write such a function that can do that?

Thanks,

Jeff

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 02:34 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-13 in 0.15 seconds with 20 queries on phoenix via your IP 54.163.209.109