NexusFi: Find Your Edge


Home Menu

 





Sell Shares from 2 positions


Discussion in EasyLanguage Programming

Updated
    1. trending_up 1,892 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?
Anyone Trading Equities using NT8?
NinjaTrader
Cycle Through Ninjatrader Open Windows
NinjaTrader
Time, Futures, Scalping, Treasurys
Treasury Notes and Bonds
RSI Values Scale
NinjaTrader
Server CPUs and Multicharts 14 or 15 limits
MultiCharts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Fighting Addiction and Stops
17 thanks
Big Mike in Ecuador
6 thanks
Just another trading journal: PA, Wyckoff & Trends
6 thanks
Crossing the Abyss: An Adventure Guide by Snax
4 thanks
Want your NinjaTrader indicator created, free?
4 thanks
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,441 since Apr 2013
Thanks Given: 491
Thanks Received: 1,634


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 Twitter 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,441 since Apr 2013
Thanks Given: 491
Thanks Received: 1,634

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 Twitter 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,441 since Apr 2013
Thanks Given: 491
Thanks Received: 1,634

jessehhhh,

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

Regards,

ABCTG

Follow me on Twitter 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,441 since Apr 2013
Thanks Given: 491
Thanks Received: 1,634

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 Twitter Reply With Quote




Last Updated on November 8, 2018


© 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 - Sitemap - Downloads - Top
no new posts