NexusFi: Find Your Edge


Home Menu

 





Stop / Profit Calculations


Discussion in EasyLanguage Programming

Updated
    1. trending_up 1,682 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?
Trump Lands in Beijing on CPI Day: Iran Peace Expires To …
Prediction Markets & Event Contracts
Oil Surges ~18% in One Week as Iran Conflict Disrupts Gl …
Commodities
Double Deadlock: Rubio Calls Hormuz Tolls "Unfeasib …
Traders Hideout
CFTC Launches Innovation Task Force for AI Trading Syste …
Traders Hideout
Orban Crashes to 21pct on Record Turnout -- McIlroy Drop …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
24 thanks
2026 Jlab journal
10 thanks
Trying to learn Volume and price action correlation
8 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Lady Vols Primer: Trading Volatility Journal
6 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


© 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