NexusFi: Find Your Edge


Home Menu

 





Stop / Profit Calculations


Discussion in EasyLanguage Programming

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




 
Search this Thread
  #1 (permalink)
joeyjoeyjoeeey
Minneapolis
 
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?
Sierra chart Trading system
Sierra Chart
New York Stock Exchange to Launch NYSE Texas
Stocks and ETFs
How to get Large data indicators to print global
NinjaTrader
Strategy runs differently with in Automated Order Execut …
MultiCharts
Multiple Timeframes in One Chart/Strategy
MultiCharts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Machine Learning Journal
41 thanks
Is the WH trying to engineer a recession? This Wall Stre …
15 thanks
Demark Indicator
5 thanks
OpenAIs Deep Research - finance/trading related prompts
3 thanks
Daytrading ES & NQ
3 thanks
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,447 since Apr 2013
Thanks Given: 493
Thanks Received: 1,639


joeyjoeyjoeeey,

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.

Regards,

ABCTG


Follow me on X Reply With Quote
Thanked by:




Last Updated on November 21, 2016


© 2025 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