NexusFi: Find Your Edge

Home Menu


Stop / Profit Calculations

Discussion in EasyLanguage Programming

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

Search this Thread

Stop / Profit Calculations

  #1 (permalink)
Posts: 4 since Nov 2016
Thanks Given: 1
Thanks Received: 0

Hello Traders!

I am fairly new to EasyLanguage, but programming a system to buy based on moving average/volume. I have a block of 5 boolean logic statements that are successive. After the last boolean (i.e. all the filters are true) I have a buy statement which works fine.

My problem is my setstoploss() and setprofittarget() statements. I first put them inside logic blocks (i.e. if marketposition = 1 then setstoploss(1000) but I was told to leave these statements outside of logic blocks and they will only create orders if I have a position.

Now I have my setstoploss and setprofittarget statements at the very end of my program (outside of any logic blocks) and when I get my buy orders filled I get my stop/profit orders in the queue but they constantly are updated as if they are being calculated on the current price as opposed to the entryprice. I am looking at the Active Orders tab and my stop/profit taking orders keep recalculating/canceling the previous order and creating new ones.

Does this have anything to do with the logic I have above my stop/profit orders? It doesn't appear that my buy orders are constantly being updated (part of the logic is that I can only have one position on, so if currentshares > 0, exit logic).

Any help would be greatly appreciated. Thanks for your time and happy trading!

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Pivot Indicator like the old SwingTemp by Big Mike
REcommedations for programming help
Sierra Chart
MC PL editor upgrade
Trade idea based off three indicators.
Traders Hideout
Better Renko Gaps
The Elite Circle
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
34 thanks
Bigger Wins or Fewer Losses?
24 thanks
Tao te Trade: way of the WLD
24 thanks
GFIs1 1 DAX trade per day journal
22 thanks
  #3 (permalink)
 ABCTG   is a Vendor
Posts: 2,435 since Apr 2013
Thanks Given: 482
Thanks Received: 1,628


it sounds like your code changes the values for the stops and targets and that's why the orders are getting updated. Normally they should stay in place once send. Without knowing your code for the stop and target it's hard to tell, though.

When you use Tradestation the explanation could also be that the stop and target can't be active at the same time and Tradestation switches between them i.e. also activates the one that is closer to the current market.



Follow me on Twitter Reply With Quote
Thanked by:

Last Updated on November 21, 2016

© 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