NexusFi: Find Your Edge


Home Menu

 





Slope model, how to avoid orders on same bar?


Discussion in EasyLanguage Programming

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




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

Hi,
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?
Tks,


Inputs:
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?
Pakistan Mediator in Tehran as Hormuz Normalization Coll …
Prediction Markets & Event Contracts
Iran Update May 8: Still Reviewing MOU, Demands Reparati …
Traders Hideout
Iran Airspace Collapses 18 Points to 15.5% While Hormuz …
Prediction Markets & Event Contracts
April 2026 Jobs Report: +115k vs +65k Expected
Traders Hideout
Wood Mackenzie Drops $200 Oil Forecast -- Airspace Expir …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
NexusFi site changelog and issues/problem reporting
15 thanks
Darmok and Jalad at Tanagra
3 thanks
Big Mike in Ecuador
1 thanks
30 Sessions
1 thanks
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,448 since Apr 2013
Thanks Given: 494
Thanks Received: 1,643


vanzolini,

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.

Regards,
ABCTG


Follow me on X Reply With Quote
Thanked by:
  #4 (permalink)
vanzolini
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
Tks,


Reply With Quote




Last Updated on October 7, 2015


© 2026 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 - Downloads - Top
no new posts