NexusFi: Find Your Edge

Home Menu


Stop Loss Buy for Entry

Discussion in EasyLanguage Programming

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

Search this Thread

Stop Loss Buy for Entry

  #1 (permalink)
Delhi India
Posts: 1 since Feb 2014
Thanks Given: 0
Thanks Received: 0

I am trying to buy 2 pips above the previous candle high when the MACD cross above happens. Code is this

inputs: FastLength( 5 ), SlowLength( 70 ), MACDLength( 100 ) ;
variables: var0( 0 ), var1( 0 ), var2( 0 ) , var3(0);

var0 = MACD( Close, FastLength, SlowLength ) ;
var1 = XAverage( var0, MACDLength ) ;
var2 = var0 - var1 ;
var3 = High[1]+1.0;

condition1 = CurrentBar > 2 and var2 crosses over 0 ;
if condition1 then
Buy( "MacdLE" ) next bar at var3 stop;

But then when I am seeing the buy value, it is showing at High[1] only and not additional 1.0 point above

Can you please help?


Reply With Quote

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


your code buys for the next market using the high from one bar ago. Which means at the time your order is sent you are using the high from two bars ago. The code is doing that fine and I didn't see wrong entries at High[1] only here.

To avoid issues I would suggest not to use something like High[1] + 1, but use pips/ticks instead like this:
High[1] + (2 * (MinMove/PriceScale))

Follow me on Twitter Reply With Quote

Last Updated on March 2, 2014

© 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