NexusFi: Find Your Edge


Home Menu

 





Sell Shares from 2 positions


Discussion in EasyLanguage Programming

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




 
Search this Thread
  #1 (permalink)
jessehhhh
Montclair
 
Posts: 17 since Nov 2018
Thanks Given: 0
Thanks Received: 0

I am looking to find the easylanguage code that will allow me to sell shares from 2 different entries.

For example:

I have 2 long entries and at a certain point I want to sell half of my entire position ( the combined shares from both strategies). The only way I have found to do this is put in 2 sell orders and effectively sell the position twice and pay double commision

Is there a way around this?


Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Orban Crashes to 21pct on Record Turnout -- McIlroy Drop …
Prediction Markets & Event Contracts
BofA Projects $1.1 Trillion in Sports Event Contracts -- …
Prediction Markets & Event Contracts
Iran Airspace Contract Surges to 33.5% as Project Freedo …
Prediction Markets & Event Contracts
South Korea Suspends Bithumb for Six Months Over AML Fai …
Cryptocurrency
Wood Mackenzie Drops $200 Oil Forecast -- Airspace Expir …
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
Algo automated / semi-automated trading anyone?
6 thanks
Lady Vols Primer: Trading Volatility Journal
6 thanks
2026 Fire Horse
5 thanks
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,447 since Apr 2013
Thanks Given: 493
Thanks Received: 1,639


jessehhhh,

take a look at the reversed word "total" as this can be used to accomplish what you have in mind.

Additionally the Advanced Example Strategies in the below topic might be helpful for you:
https://community.tradestation.com/Discussions/Topic.aspx?Topic_ID=112094

Regards,

ABCTG


Follow me on X Reply With Quote
  #4 (permalink)
jessehhhh
Montclair
 
Posts: 17 since Nov 2018
Thanks Given: 0
Thanks Received: 0

I tried that and it still didn't work.

The end of my code was "Sell Total Currentshares*.5 next bar at...

It still only sold from one of the positions.

Am I using this word wrong?


Reply With Quote
  #5 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,447 since Apr 2013
Thanks Given: 493
Thanks Received: 1,639

jessehhhh,

can you post code that can be used to reproduce what you are seeing?

Did the exit close out half of your entire position?

Regards,

ABCTG


Follow me on X Reply With Quote
  #6 (permalink)
jessehhhh
Montclair
 
Posts: 17 since Nov 2018
Thanks Given: 0
Thanks Received: 0

I don't have access to it currently but can later.

When i use that exit code it sells half of my first position only. For example if I bought 10 shares in my first entry and 10 in the second, that code sells 5 shares.

If this isn't enough info I will post my code later for help.

Thank You


Reply With Quote
  #7 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,447 since Apr 2013
Thanks Given: 493
Thanks Received: 1,639

jessehhhh,

yes, the code should provide more insights into why this is not working on your end.

Regards,

ABCTG


Follow me on X Reply With Quote
  #8 (permalink)
jessehhhh
Montclair
 
Posts: 17 since Nov 2018
Thanks Given: 0
Thanks Received: 0

After doing some digging on the Forum link you sent me I found out that it is not possible to do in an automated way.

In order for you to have 1 exit instead of to I need to turn on Adopt the real-world position in the Automation tab. However this has to be done after a position is entered and the chart needs to be refreshed which is not viable for my strategy.


Reply With Quote
  #9 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,447 since Apr 2013
Thanks Given: 493
Thanks Received: 1,639

jessehhhh,

it sounds like the entries are on different charts or not by a strategy on one chart (like a manual entry and one strategy exit). In that case it's correct that one strategy would have to be made aware of the entire position first.

One way to approach this might be to combine the two strategies into one and apply it to one chart only.

Regards,

ABCTG


Follow me on X Reply With Quote




Last Updated on November 8, 2018


© 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