Filter trades by using +DMI, help needed - EasyLanguage Programming | futures io social day trading
futures io futures trading


Filter trades by using +DMI, help needed
Updated: Views / Replies:2,486 / 5
Created: by abcplot 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 dont 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
 

Filter trades by using +DMI, help needed

  #1 (permalink)
Trading Apprentice
vienna
 
Futures Experience: Intermediate
Platform: Tradestation
Favorite Futures: Gold
 
Posts: 14 since May 2011
Thanks: 6 given, 2 received

Filter trades by using +DMI, help needed

Hello,


First off all here is a screenshot from my actual setup, below indicator is DMI. What I am trying to achieve is that trades triggered from the strategy should be avoided if +DMI is not equal or bigger than 45. As you can see on below example +DMI is actual at 34,05

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





I tried to change the code the following way(shown in red), but still trades gets triggered which are below 45 (+DMI).



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




Would be great if somebody could tell me what actually I am doing wrong here.....


Thanks a lot guys

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)
Fortitudo et Honor
Austin, TX
 
Futures Experience: Advanced
Platform: TradeStation
Favorite Futures: Futures
 
Posts: 882 since Mar 2011
Thanks: 128 given, 703 received


Couple of possibilities....

1) I can't see if you're using IOG or not, but if so, then intrabar, the value for your variable may indeed be above a certain threshold, but then settle to a lower point later in the bar and appear to have been less when reviewing later on (which only reveals the variable's final closing value, not the entire range of values it covered during the time period).

2) Prior to your if then begin string......you have a constraint (if currentshares = LTT then begin...)

What is the default value if your constraint is false?

I personally declare variables at the front of the program, I can't see the rest of your code to see if there's a reason you include it inside your if then string.

3) You need to label your entries and exits, if you have other entrie sources in your code, this will help identify which entry criteria is triggering the entry.

Reply With Quote
The following user says Thank You to RM99 for this post:
 
  #4 (permalink)
Trading Apprentice
vienna
 
Futures Experience: Intermediate
Platform: Tradestation
Favorite Futures: Gold
 
Posts: 14 since May 2011
Thanks: 6 given, 2 received

Hello,


First of all, thanks to your reply! In order to give you an overview what I am trying to accomplish, following information:

Im am trying to modify the original Turtle system, based on a 20/55 Donchian breakout to perform as below:
  • Use only 90 days as a breakout signal in each direction (long/short)
  • Additional DMIplus (long) or DMIminus (short) needs to be equal or higher than 45 (at first entry and afterwards for each pyramiding entry), if this condition is not given, skip those trades
  • Used Data is EOD only, no intraday action, if bar is the highest whitin 90 days, then enter at tomorrows open
Below a screenshot as it looks right now. The yellow and red dotted lines are from a additional indicator in order to check the entries/exits calculated by the strategy, this one has no influence on the strategy, just in use for verfication

inputs:
Breakoutlength: 90 --> yellow dotted line
Stoplength: 10 --> red dotted line (ATR exit)
N: 2 --> 2 times the true range
ATRlenght: 20


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





Below is the current status of the performed modifications of the original 20/55 Turtle system:


Hoping you can take a look at it in order to let me know what actually needs to be changed to achieve above defined requirements.




 
Code
vars: N(0),StopLoss(1),DV(0),BB(0),AccountBalance(0),DollarRisk
(0),LTT(0), 
Tracker(0),LastTrade(0),HBP(0),LBP(0); input: InitialBalance
(50000),Length(20); 
if marketposition = 0 then begin 
BB = 0; 
N = xAverage( TrueRange, Length ); 
DV = N * 100; {Bigpointvalue set to 100}
AccountBalance = InitialBalance; 
DollarRisk = AccountBalance * .03; {3 Percent/ Trade}
LTT = IntPortion(DollarRisk/DV); 
StopLoss = 2 * DV * LTT; 
if LastTrade = -1 then begin
buy LTT shares next bar highest(h,90) or higher; 
buy LTT shares next bar highest(h,90) + (0.5*N) or higher; 
buy LTT shares next bar highest(h,90) + (1.0*N) or higher; 
buy LTT shares next bar highest(h,90) + (1.5*N) or higher; 
sellshort LTT shares next bar lowest(l,90) or lower; 
sellshort LTT shares next bar lowest(l,90) - (0.5*N) or lower; 
sellshort LTT shares next bar lowest(l,90) - (1.0*N) or lower; 
sellshort LTT shares next bar lowest(l,90) - (1.5*N) or lower; 
end; 
if LastTrade = 1 then begin 
buy LTT shares next bar highest(h,90) or higher; 
buy LTT shares next bar highest(h,90) + (0.5*N) or higher; 
buy LTT shares next bar highest(h,90) + (1.0*N) or higher; 
buy LTT shares next bar highest(h,90) + (1.5*N) or higher; 
sellshort LTT shares next bar lowest(l,90) or lower; 
sellshort LTT shares next bar lowest(l,90) - (0.5*N) or lower; 
sellshort LTT shares next bar lowest(l,90) - (1.0*N) or lower; 
sellshort LTT shares next bar lowest(l,90) - (1.5*N) or lower; 
end; 
end; 
// PREVIOUS TRADE TRACKER 
if HBP = 0 and h > highest(h,89)[1] then begin 
Tracker = 1; HBP = h; LBP = 0; 
end; 
if LBP = 0 and l < lowest(l,89)[1] then begin 
Tracker = -1; LBP = l; HBP = 0; 
end; 
if Tracker = 1 then begin 
if l < HBP - (2*N) then LastTrade = -1; 
if h > HBP + (4*N) then LastTrade = 1; 
end; 
if Tracker = -1 then begin 
if h > LBP + (2*N) then LastTrade = -1; 
if l < LBP - (4*N) then LastTrade = 1; 
end; 
 
// LONG 90 
if LastTrade = 1 and marketposition = 1 then begin 
BB = BB + 1; 
if currentshares = LTT then begin
 
 Value99=DMIPlus(14);
 if value99>=45 then;
 
buy LTT shares next bar highest(h,90)[BB] + (0.5*N) or higher;
buy LTT shares next bar highest(h,90)[BB] + (1.0*N) or higher;
buy LTT shares next bar highest(h,90)[BB]+ (1.5*N) or higher; 
end; 
if currentshares = LTT * 2 then begin 
buy LTT shares next bar highest(h,90)[BB] + (1.0*N) or higher; 
buy LTT shares next bar highest(h,90)[BB] + (1.5*N) or higher; 
end; 
if currentshares = LTT * 3 then 
buy LTT shares next bar highest(h,90)[BB] + (1.5*N) or higher; 
end; 
sell ("out-S") next bar lowest(l,10) or lower; 
 
// SHORT 90
if LastTrade = 1 and marketposition = -1 then begin 
BB = BB + 1; 
if currentshares = LTT then begin
 
 Value79=DMIminus(14);
 if value79>=45 then;
 
sellshort LTT shares next bar lowest(l,90)[BB] - (0.5*N) or lower; 
sellshort LTT shares next bar lowest(l,90)[BB] - (1.0*N) or lower; 
sellshort LTT shares next bar lowest(l,90)[BB] - (1.5*N) or lower; 
end; 
if currentshares = LTT * 2 then begin 
sellshort LTT shares next bar lowest(l,90)[BB] - (1.0*N) or lower; 
sellshort LTT shares next bar lowest(l,90)[BB] - (1.5*N) or lower; 
end; 
if currentshares = LTT * 3 then 
sellshort LTT shares next bar lowest(l,90)[BB] - (1.5*N) or lower; 
end; 
buytocover ("out-B") next bar highest(h,10) or higher; 
// STOPS 
if currentshares = (2 * LTT) then StopLoss = DV * 3.5 * LTT; 
if currentshares = (3 * LTT) then StopLoss = DV * 4.5 * LTT; 
if currentshares = (4 * LTT) then StopLoss = DV * 5.0 * LTT; 
setstoploss (StopLoss); 
// COMMENTARY 
commentary ("LTT: ",LTT,Newline); 
commentary ("CurrentShares: ",CurrentShares,Newline); 
commentary ("StopLoss: ",StopLoss,Newline); 
commentary ("AccountBalance:",AccountBalance,NewLine); 
commentary ("LastTrade: ",LastTrade,NewLine);

Reply With Quote
 
  #5 (permalink)
Elite Member
London, England
 
Futures Experience: Intermediate
Platform: MC, TS, NT
Broker/Data: TradeStation
Favorite Futures: ES
 
Posts: 41 since Oct 2009
Thanks: 12 given, 19 received

The if statements apply only to the next line unless there is a "begin...end", so it seems you need to review the strategy carefully to ensure the logic is correct. For example regarding you DMI value it look slike it should say:

if value99>=45 then
-----begin
-----------buy LTT shares next bar highest(h,90)[BB] + (0.5*N) or higher;
-----------buy LTT shares next bar highest(h,90)[BB] + (1.0*N) or higher;
-----------buy LTT shares next bar highest(h,90)[BB]+ (1.5*N) or higher;
-----end;

The best way to 'see' the structure would be to properly indent all begin end blocks, for example:

if A = B then
--------begin
--------------if C=D then
----------------------begin
--------------------------------statement1;
--------------------------------statement2;
----------------------end;
--------end;

Another comment is that the SetStopLoss whould never be within an If statement. This may result in there being no stoploss, not because of the strategy logic but just an "anomally" with easylanguage.

Paul

Reply With Quote
 
  #6 (permalink)
Fortitudo et Honor
Austin, TX
 
Futures Experience: Advanced
Platform: TradeStation
Favorite Futures: Futures
 
Posts: 882 since Mar 2011
Thanks: 128 given, 703 received

Agreed.

Coding is a skill and so is debugging.

Part of debugging is coding with a certain organization. That's why it helps to ensure that you follow the textbook grouping and sequence of coding.

TS has templates that will help you stay organized. Generally you start with inputs, then variables, then you declare your variables, then you work the body of your program, entries, then money management and exits.

Something as simple as placing variable declaration in the wrong location can screw things up.

Reply With Quote

Reply



futures io > > > > > Filter trades by using +DMI, help needed

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
DMI + OBV setup cory The Elite Circle 21 November 5th, 2016 12:26 AM
Need help using Awesome Oscillator as a filter protrader007 NinjaTrader Programming 19 August 30th, 2016 05:11 PM
Three Way Filter with Boolean Setup zeller4 NinjaTrader Programming 3 July 19th, 2011 09:19 PM
Just a little code assist needed for entry filter Trader.Jon NinjaTrader Programming 2 October 27th, 2010 02:25 PM
DMI indicator cory Traders Hideout 3 September 5th, 2009 03:48 AM


All times are GMT -4. The time now is 04:00 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.11 seconds with 19 queries on phoenix via your IP 107.20.115.174