NexusFi: Find Your Edge


Home Menu

 





Slope model, how to avoid orders on same bar?


Discussion in EasyLanguage Programming

Updated
    1. trending_up 1,697 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?
The June 15 Resolution Trap: Irans Agreed Text Still Pri …
Prediction Markets & Event Contracts
MyForexFunds Begins Returning Frozen Funds After CFTC Ca …
Funded Trading Evaluation Firms
Rubios Good News Within Hours and the 30-Day Math: Why H …
Prediction Markets & Event Contracts
Sundays Verdict: Lebanon Locked at 99.85% as Iran June 7 …
Prediction Markets & Event Contracts
Trump Truth Social Fires Hormuz From 10% to 59% -- Arsen …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Big Mike in Ecuador
197 thanks
Sober Journey With S&P
27 thanks
30 Sessions
20 thanks
BERN ALGOS algo trading journal
8 thanks
Volume Indicators
8 thanks
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,448 since Apr 2013
Thanks Given: 494
Thanks Received: 1,642


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