buy next bar... and set stop immediately and not for the bar after - EasyLanguage Programming | futures io social day trading
futures io futures trading


buy next bar... and set stop immediately and not for the bar after
Updated: Views / Replies:8,064 / 12
Created: by Nicolas11 Attachments:7

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

buy next bar... and set stop immediately and not for the bar after

  #11 (permalink)
Elite Member
modena, Italy
 
Futures Experience: Intermediate
Platform: Mc9+IB+iqfeed
Broker/Data: IB
Favorite Futures: stocks, futures
 
Posts: 4 since Apr 2014
Thanks: 0 given, 0 received

Hi,
i was reading your post here and got surprised by the standard MC stoploss function:

inputs: StopLossPct( .05 ) ;

SetStopShare ;
if MarketPosition = -1 then
SetStopLoss( EntryPrice * StopLossPct )
else
Buy To Cover ( "PctStopSX-eb" ) next bar at Close * ( 1 + StopLossPct ) stop ;

Basically it looks the function sens a BUY to cover even if no position is open and when a position is open it changes it with a setstoploss.

I am confused.

My target is to have a stop loss that acts on the same bar of the entry but at the same time i can't use barmagnifier (i use a continuos future and it is not allowed in MC).

What's the best way to achieve this?

If write this generic stoploss function does it make sense?

inputs:
LXStopLossPct(0.05),
SXStopLossPct(0.05),
Futures(true);

vars:
mlt(1);

If Futures then mlt = bigpointvalue;

SetStopShare;
if (MarketPosition = 1) and (LXStopLossPct > 0) then SetStopLoss(EntryPrice * LXStopLossPct * mlt);
if (MarketPosition = -1) and (SXStopLossPct > 0) then SetStopLoss(EntryPrice * SXStopLossPct * mlt);

if (MarketPosition = 0) and (LXStopLossPct > 0) then Sell ( "PctStopLX-eb" ) next bar at EntryPrice * ( 1 - (LXStopLossPct * mlt)) stop;
if (MarketPosition = 0) and (SXStopLossPct > 0) then Buy To Cover ( "PctStopSX-eb" ) next bar at EntryPrice * ( 1 + (SXStopLossPct * mlt)) stop;


In my view this make not much sense but the standard MC function looks similar to this.

Reply With Quote
 
  #12 (permalink)
Market Wizard
Hamburg Germany
 
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 1,533 since Apr 2013
Thanks: 231 given, 855 received
Forum Reputation: Legendary

lbottan,

you should try your code on a simulation account to see how it works. I would slightly rewrite it to this (note that I didn't check/test your code, it's just a modification of what you wrote). There is a difference in both codes in that yours does only send the buy to cover or sell order for Marketposition = 0.
Without the BarMagnifier and depending on the resolution you work with, the results shouldn't be trusted and carefully checked with simulted (at least, live would be better) forward testing! There is simply too much information missing in bar and the program tends to make wrong assumptions then - for example was a stop hit first before the target was reached or vice versa.

 
Code
inputs:
LXStopLossPct(0.05),
SXStopLossPct(0.05),
Futures(true);

vars:
mlt(1);

If Futures then mlt = bigpointvalue;

SetStopShare;

if (LXStopLossPct > 0)  then
begin
   if (MarketPosition = 1) then 
              SetStopLoss(EntryPrice * LXStopLossPct * mlt)
   else
              Sell ( "PctStopLX-eb" ) next bar at EntryPrice * ( 1 - (LXStopLossPct * mlt)) stop;
end ;

if (SXStopLossPct > 0) then
begin
   if (MarketPosition = -1) then 
              SetStopLoss(EntryPrice * SXStopLossPct * mlt)
   else
               Buy To Cover ( "PctStopSX-eb" ) next bar at EntryPrice * ( 1 + (SXStopLossPct * mlt)) stop;
end ;
Regards,
ABCTG


lbottan View Post
Hi,
i was reading your post here and got surprised by the standard MC stoploss function:

inputs: StopLossPct( .05 ) ;

SetStopShare ;
if MarketPosition = -1 then
SetStopLoss( EntryPrice * StopLossPct )
else
Buy To Cover ( "PctStopSX-eb" ) next bar at Close * ( 1 + StopLossPct ) stop ;

Basically it looks the function sens a BUY to cover even if no position is open and when a position is open it changes it with a setstoploss.

I am confused.

My target is to have a stop loss that acts on the same bar of the entry but at the same time i can't use barmagnifier (i use a continuos future and it is not allowed in MC).

What's the best way to achieve this?

If write this generic stoploss function does it make sense?

inputs:
LXStopLossPct(0.05),
SXStopLossPct(0.05),
Futures(true);

vars:
mlt(1);

If Futures then mlt = bigpointvalue;

SetStopShare;
if (MarketPosition = 1) and (LXStopLossPct > 0) then SetStopLoss(EntryPrice * LXStopLossPct * mlt);
if (MarketPosition = -1) and (SXStopLossPct > 0) then SetStopLoss(EntryPrice * SXStopLossPct * mlt);

if (MarketPosition = 0) and (LXStopLossPct > 0) then Sell ( "PctStopLX-eb" ) next bar at EntryPrice * ( 1 - (LXStopLossPct * mlt)) stop;
if (MarketPosition = 0) and (SXStopLossPct > 0) then Buy To Cover ( "PctStopSX-eb" ) next bar at EntryPrice * ( 1 + (SXStopLossPct * mlt)) stop;


In my view this make not much sense but the standard MC function looks similar to this.


Reply With Quote
 
  #13 (permalink)
Trading Apprentice
London
 
Futures Experience: Intermediate
Platform: TradeStation
Favorite Futures: Crude CL, FX
 
Posts: 3 since Aug 2017
Thanks: 9 given, 0 received



Nicolas11 View Post
I have thought again about this issue...

My rephrased question is the following: After having entered "at market" (= at the open), is it possible to have a stop loss triggered on the same bar as the said entry?

My conclusion is: it depends on the way the stop loss is coded.

1. With a manual stop loss, answer is NO.
.....

2. With a built-in stop loss (SetStopLoss), answer is YES.

[CODE]Variables:
TickSize ( MinMove / PriceScale );

if MarketPosition = 0 and H < H[1] and L > L[1] {inside bar} then begin
Buy ("Entry LONG") next bar at market;
SetStopLoss(5 * TickSize * BigPointValue);
end;

Thanks for sharing this. That was easy for me to implement and adjust in my code (even several years after you posted this!)

Reply With Quote

Reply



futures io > > > > > buy next bar... and set stop immediately and not for the bar after

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
End of bar strategies with advanced bar types (Renko, Range, Kagi, etc) RM99 Elite EasyLanguage Automated Trading 2 September 9th, 2011 09:38 AM
Whats the difference between Bar Magnifier & look inside bar testing? crbucks MultiCharts 1 May 4th, 2011 01:22 AM
Image:al brooks reading price charts bar by bar.jpg Big Mike Trading Wiki Images 0 July 1st, 2010 09:00 PM
Stop using the value of an indicator on previous bar nanobiotech NinjaTrader Programming 6 March 29th, 2010 11:20 PM


All times are GMT -4. The time now is 04:55 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.09 seconds with 20 queries on phoenix via your IP 54.163.210.170