NexusFi: Find Your Edge

Home Menu


Slope model, how to avoid orders on same bar?

Discussion in EasyLanguage Programming

    1. trending_up 1,270 views
    2. thumb_up 1 thanks given
    3. group 2 followers
    1. forum 3 posts
    2. attach_file 0 attachments

Search this Thread

Slope model, how to avoid orders on same bar?

  #1 (permalink)
Sao Paulo, Sao Paulo/Brazil
Posts: 11 since Sep 2015
Thanks Given: 10
Thanks Received: 1

I am trying to code a strategy for the slope strategy used by Marty Zweig and Ned Davis on weekly charts
What I am trying to do is to buy if prices rallies, say 5% from a 10-day low
The idea is to reverse and go short if prices decline by 5% from a 10-day high
I coded the ideas as below, but the system is entering buys and sells on the same bar ...
How can I avoid that?

Length (10),
BuySignal (0.05),
SellSignal (-0.05);

If (Close/Lowest(Low[1], Length)-1) > BuySignal then buy next bar at market;

If (Close/Highest(High[1], Length)-1) < SellSignal then sellshort next bar at Market;

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Platforms and Indicators
Pivot Indicator like the old SwingTemp by Big Mike
How to apply profiles
Traders Hideout
NT7 Indicator Script Troubleshooting - Camarilla Pivots
Exit Strategy
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
48 thanks
Just another trading journal: PA, Wyckoff & Trends
35 thanks
Tao te Trade: way of the WLD
25 thanks
Bigger Wins or Fewer Losses?
24 thanks
GFIs1 1 DAX trade per day journal
21 thanks
  #3 (permalink)
 ABCTG   is a Vendor
Posts: 2,435 since Apr 2013
Thanks Given: 482
Thanks Received: 1,628


the first consideration would be, if the entries happen at the correct spot i.e. did the same bar actually
decline from the high and advance from the low by X percent?
If that is the case you'd need to decide which order to take.

From your code it appears that orders can be sent as long as the conditions are fulfilled. Is this something you want?
If you have a trend for example and ten consecutive bars that are higher by X percent than the lowest low from 10 bars ago, all of the bars could trigger an entry.


Follow me on Twitter Reply With Quote
Thanked by:
  #4 (permalink)
Sao Paulo, Sao Paulo/Brazil
Posts: 11 since Sep 2015
Thanks Given: 10
Thanks Received: 1

You are right ABCTG
Let me go back to my strategy and think this over

Reply With Quote

Last Updated on October 7, 2015

© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
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.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts