NexusFi: Find Your Edge


Home Menu

 





Question about MC "Sell" and "BuyToClose" syntax


Discussion in MultiCharts

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




 
Search this Thread

Question about MC "Sell" and "BuyToClose" syntax

  #1 (permalink)
 
Sinatra Fan's Avatar
 Sinatra Fan 
Orlando FL
 
Experience: Intermediate
Platform: MultiCharts, Ninja
Trading: Emini ES
Posts: 66 since May 2019
Thanks Given: 7
Thanks Received: 9

So I've been programming with EASY/POWERlanguage for about 13 years now. And I'm not too proud to say that I'm not a "know-it-all" nor do I pretend to know everything there is to know. With that said, I'm in the process of coding a strategy that adds contracts and takes off contracts during a trade. While thinking of how to do this, I decided to actually look up the keyword "SELL" in the reference guide. In there, I found the following example:

Completely exit from the long position established by the entry labeled "Original
Entry", at Market price on open of next bar:


Sell From Entry("Original Entry")Next Bar At Open;

Sell 10 shares of the long position established by the entry labeled "Original
Entry", at Market price on open of next bar:


Sell Entry("Original Entry")10 Shares Next Bar At Market;

I found this useful but perplexing at the same time. So I must ask the community for clarity. Let's say I put in code that will Buy 20 contracts once the signal tests are met and I call that trade "Original Entry" Then, while that position is open, the strat identifies another condition and buys another 10 contracts that is labeled "Second Position". So now there is a total of 30 contracts open (20 under the label "Original Entry" and 10 under the label "Second Position".) Is MC's example in the reference guide saying that if I want to close all or some of only the contracts in the "Original Entry" position, it will do it with the examples shown? Please confirm.

Also, if the strategy has used this label in prior positions but are now closed out, is this a problem? In other words, can I assume it will only consider the open trades and nothing already closed out?

Thanks for the help.

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Exit Strategy
NinjaTrader
Better Renko Gaps
The Elite Circle
PowerLanguage & EasyLanguage. How to get the platfor …
EasyLanguage Programming
How to apply profiles
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
31 thanks
Spoo-nalysis ES e-mini futures S&P 500
28 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
20 thanks
GFIs1 1 DAX trade per day journal
17 thanks
  #2 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,433 since Apr 2013
Thanks Given: 481
Thanks Received: 1,627

Hello Sinatra Fan,

an exit tied to a specific entry name will only close shares/lots/contracts from entries with that name. If nothing is left to close from that entry it would not affect differently named entries.
In case you have multiple entries open that share the same name an exit like you wrote below would be applied to all entries with the same name. Using the "Total" reserved word in an exit allows you to change that default behavior.

This is a good topic for testing various scenarios on a chart as this should clarify all your questions and show you how you can control the behavior of exits.

Regards,

ABCTG




Sinatra Fan View Post
So I've been programming with EASY/POWERlanguage for about 13 years now. And I'm not too proud to say that I'm not a "know-it-all" nor do I pretend to know everything there is to know. With that said, I'm in the process of coding a strategy that adds contracts and takes off contracts during a trade. While thinking of how to do this, I decided to actually look up the keyword "SELL" in the reference guide. In there, I found the following example:

Completely exit from the long position established by the entry labeled "Original
Entry", at Market price on open of next bar:


Sell From Entry("Original Entry")Next Bar At Open;

Sell 10 shares of the long position established by the entry labeled "Original
Entry", at Market price on open of next bar:


Sell Entry("Original Entry")10 Shares Next Bar At Market;

I found this useful but perplexing at the same time. So I must ask the community for clarity. Let's say I put in code that will Buy 20 contracts once the signal tests are met and I call that trade "Original Entry" Then, while that position is open, the strat identifies another condition and buys another 10 contracts that is labeled "Second Position". So now there is a total of 30 contracts open (20 under the label "Original Entry" and 10 under the label "Second Position".) Is MC's example in the reference guide saying that if I want to close all or some of only the contracts in the "Original Entry" position, it will do it with the examples shown? Please confirm.

Also, if the strategy has used this label in prior positions but are now closed out, is this a problem? In other words, can I assume it will only consider the open trades and nothing already closed out?

Thanks for the help.


Follow me on Twitter Reply With Quote
  #3 (permalink)
 
Sinatra Fan's Avatar
 Sinatra Fan 
Orlando FL
 
Experience: Intermediate
Platform: MultiCharts, Ninja
Trading: Emini ES
Posts: 66 since May 2019
Thanks Given: 7
Thanks Received: 9


OK, so now I have a new scenario.

Lets say I go long with 10 contracts. along the way, I want to close 9, leaving 1 open. What would my sell code look like?

Started this thread Reply With Quote




Last Updated on March 18, 2021


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