Strategy help: Trying to have entry, set stop loss, and set target on the next bar - EasyLanguage Programming | futures io social day trading
futures io futures trading


Strategy help: Trying to have entry, set stop loss, and set target on the next bar
Updated: Views / Replies:1,505 / 2
Created: by turboscottomatic Attachments:0

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

Strategy help: Trying to have entry, set stop loss, and set target on the next bar

  #1 (permalink)
Elite Member
nyc
 
Futures Experience: Intermediate
Platform: NT, MC
 
Posts: 4 since Dec 2009
Thanks: 0 given, 0 received

Strategy help: Trying to have entry, set stop loss, and set target on the next bar

Hi all,

I have some moderate Easy Language indicator programming ability. Most of the strategy entry/exit/position stuff is new to me. I hope you can help me. FYI, I have and use both MultiCharts and TS. I am trying to phase out of TS into MC, so that's where I am trying to execute this.

I am trying to code a strategy that sets a limit entry (on some Entry Condition) AND a fixed stop loss AND a fixed target on the next bar. I am trying to code a 'set and forget' kind of thing for EOD daily trading. I want all 3 (limit entry, stop, target) to all fire on the SAME BAR and to execute at specific prices. And I want the stop and target to persist as long as my entry is active (marketposition = 1 or -1).

The easy way to visualize this is like what happens during strategy trading on Ninja: as soon as your order is hit a stop and target are sent immediately. And they stick around until one of them is hit.

In general, I am using something like a Keltner Channel and, for a LONG trade, my setup condition resembles: if the channel is headed up and the bar closes above the midline , I want to set a limit order at the midline (below price), and a target at the upper channel, and a stoploss at the lower channel, to trigger at the NEXT bar, all three.

The idea is not revolutionary, a quick pullback in an uptrend triggers a limit order and sets a stop below and a target above. Reverse for shorts. BTW, there is a PDF all over the WWW describing this method as a Linda Bradford Raschke setup in an issue of Chartpoint. You can find it by googling "Kevin Ho Scalp Trading Methods." It is Pattern 5: The 5-Minute Standard Deviation Scalp in the PDF. I am trying to turn that into a end of day backtestable strategy.

I got some ideas from this thread, but I'm not succeeding:
https://futures.io/easylanguage-programming/14837-buy-next-bar-set-stop-immediately-not-bar-after.html

Here is what is currently NOT working:

 
Code
//Entry conditions
LongEntCond = Avg> Avg[1] and close > Avg;
ShortEntCond = Avg< Avg[1] and close < Avg;

//LONG Entry, Stop, and Target
if MarketPosition = 0 and (LongEntCond) then begin
    Buy ("Entry LONG") next bar at Avg limit;
    SetStopLoss( Avg - LowerBand );
    SetProfitTarget( UpperBand - Avg );
end;

 //SHORT Entry, Stop, and Target
 if MarketPosition = 0 and (ShortEntCond) then begin
    SellShort ("Entry SHORT") next bar at Avg limit;
    SetStopLoss ( UpperBand - Avg );
    SetProfitTarget ( Avg - LowerBand );
end;
I also tried using code which enters next bar and is followed by stop and target next bar after that (next after next, if you get me ):

 
Code
//Long entry routines
if marketposition = 0 then begin
	if LongEntCond then 
	buy ("L-Ent") next bar at Avg limit;
end;

//Long exit routines
if marketposition = 1 then begin
	sell ("L-tgt") next bar at UpperBand stop;
	sell ("L-stp") next bar at LowerBand limit;
end;
This seemed to sort of work, but didn't in two ways: 1. The stop and target execution were at bar close instead of at specific prices, and 2. The entry bar did not have the stop and target attached until the following bar, meaning that trades entered and exited on the same bar were not shown. In a fast 1:1 RR 1xATR method like this, it happens often enough to matter. A single bar dipping down followed by a one ATR upthrust in an uptrend happens all the time

I don't know enough about Bar Magnifier to know if it is useful here. I don't think I can use intrabarordergeneration because I am using daily bars and would like to test this against years of data. I don't have years of minute data available to match it.

I am sure others beside myself would benefit from this. Daytrading wears me out. I would love to test and have faith in a good ole' EOD method that I set at 5 pm and walk away from. But have faith in it from solid testing and statistics. I hope to recreate reality in backtesting as faithfully as possible, including same day entries and exits.

I don't post here much but I read a lot and learn a lot. Thanks to all!

Scott

Reply With Quote
 
  #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.

 
  #3 (permalink)
Elite Member
nyc
 
Futures Experience: Intermediate
Platform: NT, MC
 
Posts: 4 since Dec 2009
Thanks: 0 given, 0 received


Never mind. Got it.

Setstoploss and setprofittarget cannot be inside a conditional statement. So this works fine:

 
Code
//Entry conditions
LongEntCond = Avg> Avg[1] and close > Avg;
ShortEntCond = Avg< Avg[1] and close < Avg;

//LONG Entry, Stop, and Target
if MarketPosition = 0 and (LongEntCond) then begin
    Buy ("Entry LONG") next bar at Avg limit;
end;

 //SHORT Entry, Stop, and Target
 if MarketPosition = 0 and (ShortEntCond) then begin
    SellShort ("Entry SHORT") next bar at Avg limit;
end;

SetStopLoss( UpperBand - Avg );
SetProfitTarget( UpperBand - Avg );

Reply With Quote

Reply



futures io > > > > > Strategy help: Trying to have entry, set stop loss, and set target on the next bar

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
How to set up a daily stop loss? sunsun MultiCharts 7 December 13th, 2015 09:56 AM
Daily stop loss limit set mechanical with AMP futures, help. hector24 Reviews of Brokers and Data Feeds 3 November 11th, 2014 10:32 PM
How to set a dinamic stop loss based on percent Astrogirl NinjaTrader Programming 11 October 20th, 2013 10:22 AM
Set Stop loss gerimo NinjaTrader Programming 3 May 24th, 2012 02:36 PM
How to set up a Stop (Limit) Loss order - Ninja Trader jdumanic NinjaTrader 2 June 7th, 2011 06:40 PM


All times are GMT -4. The time now is 03:08 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.07 seconds with 19 queries on phoenix via your IP 54.163.209.109