NexusFi: Find Your Edge


Home Menu

 





Stop Loss Buy for Entry


Discussion in EasyLanguage Programming

Updated
    1. trending_up 1,657 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)
tahseen
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?

Thanks

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
About a successful futures trader who didnt know anythin …
Psychology and Money Management
Cheap historycal L1 data for stocks
Stocks and ETFs
REcommedations for programming help
Sierra Chart
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Trade idea based off three indicators.
Traders Hideout
 
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,436 since Apr 2013
Thanks Given: 482
Thanks Received: 1,629


tahseen,

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:
 
Code
High[1] + (2 * (MinMove/PriceScale))
Regards,
ABCTG

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