NexusFi: Find Your Edge


Home Menu

 





Distinguish a Long from a Short Position


Discussion in TradeStation

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




 
Search this Thread
  #1 (permalink)
tradestation18
Porto Portugal
 
Posts: 16 since May 2018
Thanks Given: 1
Thanks Received: 1

Is it possible to distinguish if a position is Long or Short ? I wanted to code a different strategy whether the open position is long or short.


Reply With Quote

Can you help answer these questions
from other members on NexusFi?
My Rant with AMP Futures
Trading Reviews and Vendors
[WTS] ATAS Lifetime ULTRA license – EU buyers only – …
Platforms and Indicators
I developed a free AI-powered (Kronos) forecasting indic …
The Elite Circle
requesting .nrd replay files from 2026 spy and qqq
The Elite Circle
EA
Platforms and Indicators
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Would you consider buying or leasing an algo?
4 thanks
Big Mike in Ecuador
4 thanks
Trading Journal (Neural Network Production Pipeline Mode …
4 thanks
Trading psychology articles
4 thanks
The Scalpers Journey
2 thanks
  #2 (permalink)
 
teamtc247's Avatar
 teamtc247 
Fairburn, Georgia
Master Mistake Maker
 
Experience: None
Posts: 980 since Dec 2012
Thanks Given: 644
Thanks Received: 1,116


tradestation18 View Post
Is it possible to distinguish if a position is Long or Short ? I wanted to code a different strategy whether the open position is long or short.

Your question is vague. How are you deciding to be long or short?


Process oriented goals #1.
Visit my NexusFi Trade Journal Reply With Quote
  #3 (permalink)
 choke35 
Germany
Market Wizard
 
Experience: Intermediate
Platform: Other
Trading: ES, YM, 6E
Posts: 2,622 since Feb 2013
Thanks Given: 5,101
Thanks Received: 6,558



tradestation18 View Post
Is it possible to distinguish if a position is Long or Short ? I wanted to code a different strategy whether the open position is long or short.

Assuming you are using TS and that you are just interested in the syntax, you need

MarketPosition(Num)

with Num: number of positions ago

E.g.:
Mypos = MarketPosition(2); {returns 1 if MarketPosition 2 positions ago was long; -1 if short; 0 if flat}

Regarding the current position that means:
Currpos = MarketPosition(0); {returns 1 if the current MarketPosition is long; -1 if short; 0 if flat}

P.S.:
You can download the searchable EasyLanguage PDF Reference here:
https://uploads.tradestation.com:443/uploads/EasyLanguage-Functions-and-Reserved-Words-Reference.pdf


Reply With Quote
Thanked by:
  #4 (permalink)
tradestation18
Porto Portugal
 
Posts: 16 since May 2018
Thanks Given: 1
Thanks Received: 1


teamtc247 View Post
Your question is vague. How are you deciding to be long or short?

Yes, the idea is decide an order depending on being Short or Long. So if I am Long then I´ll move to a strategy A but if I am Short I move to a strategy B.
Thanks


Reply With Quote




Last Updated on September 21, 2020


© 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