NexusFi: Find Your Edge


Home Menu

 





Managing multiple entries


Discussion in EasyLanguage Programming

Updated
    1. trending_up 8,441 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)
 arjfca 
Montreal, Canada
 
Experience: Intermediate
Platform: Multicharts
Broker: Interactive Broker
Trading: Forex
Posts: 263 since Sep 2010
Thanks Given: 440
Thanks Received: 91

Hello to all

I'm new to Multicharts / Easylanguage programation and I'm stuck with a problem

I have developp a strategy that take a position for all valid signal in the same direction. Each entry as its own profit target and stop loss. Since under some conditions, I have to modify stop value, I need a way to reference them because each individualy entry may have a different stops

Now, how do I manage these entrys?
Easylanguage does not permit to attribute a string variable to a Buy or sell position name. Each entry as the same name

Buy "Position_long_1" 100 share at market.

In this exemple, "Position_long_1" as to be predetermine in the script, can't be a variable. My desire is to differentiate them using a counter

Buy "Position_long_1" 10000 share at market.
...
...
Buy "Position_long_2" 100 share at market.

Sell "Position_long_1" 10000 share at market.
...
...
Sell "Position_long_2" 100 share at market.

Hope I'm clear enough

Martin


Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Trump Media to sell instant access to market-moving soci …
Traders Hideout
EA
Platforms and Indicators
No book, only a stair: journaling fills where price move …
Cryptocurrency
requesting .nrd replay files from 2026 spy and qqq
The Elite Circle
My Rant with AMP Futures
Trading Reviews and Vendors
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Mes vs MNQ
6 thanks
NexusFi site changelog and issues/problem reporting
5 thanks
BERN ALGOS algo trading journal
3 thanks
Johnnys Journal
2 thanks
TopStep Trader disappointment
2 thanks
  #3 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 R.I.P. 1977-2026 
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,669 since Jun 2009
Thanks Given: 33,669
Thanks Received: 102,590


From the MultiCharts help...

 
Code
                            


Buy
Enters a long position 
as specified by the parameters. 
The entry point is visually indicated on a chart by an Arrow and a Tick. The Arrow identifies the time and the Tick identifies the price value of the entry point. Labels, displaying the entry name and the number of contracts or shares traded, are displayed below the Buy Arrow. 

An order is executed at the point specified by the parameters; if the order is not filled within the specified bar, the order is cancelled. 

When a Buy order is filled, any open short positions will also be closed. 
 



Usage
Buy
[("EntryLabel")][TradeSize]EntryType; 

Parameters inside the square brackets are optional 

Parameters 


EntryLabel 
- an optional parameter; assigns a name that will be displayed in the name label below the entry, and can be used to identify the particular entry and to tie an exit to it.

An exit can only be tied to an entry within the same signal; for more information, see Sell. 

If 
EntryLabel is not specified, the name "Buy" will be used for the first entry, "Buy#2" for the second entry, "Buy#3" for the third entry, etc. 


TradeSize - an optional parameter; a numerical expression, specifying the number of contracts or shares to buy; the expression must be followed by one of the following transposable words: Share, Shares, Contract or Contracts.

If 
TradeSize value equals 0 or is negative, a long position will not be entered but any open short positions will be closed.

If 
TradeSize is not specified, the trade size value set by the user in the Properties tab of the Strategy Properties window will be used. 


EntryType - a required parameter; specifies the timing and price of entry. 

There are four kinds of EntryType: 

This Bar[On]Close 

Where
: - On  is a skip word and can be omitted

A Buy Arrow will be placed at the current bar
's Close tick. 



Next Bar[At]Open  or  Next Bar[At]Market 

Where: - words "Market" and "Open" are transposable
             - At  is a skip word and can be omitted


A Buy Arrow will be placed at the next bar'
s Open tick. 

Next Bar[At]Price  Limit 

Where
: - Price  is a numerical expression, specifying the Limit Price
             
- At  is a skip word and can be omitted

A Buy Arrow will be placed on the next bar at the first tick with a price value less than 
or equal to Price ; if there are no such ticks within the next bar, the order will be cancelled.

Next Bar[At]Price  Stop 
Where
: - Price  is a numerical expression, specifying the Stop Price
             
- At  is a skip word and can be omitted


A Buy Arrow will be placed on the next bar at the first tick with a price value equal to 
or greater than the Price ; if there are no such ticks within the next bar, the order will be cancelled. 
 



Example
Buy a user
-set number of shares at Market price on close of this bar: 

Buy This Bar On Close; 



Buy 1 share at Market price on open of next bar and label the entry "Entry": 

Buy("Entry")1 Share Next Bar At Open; 



Buy 1 contract at Market price on open of next bar and label the entry "Entry": 

Buy("Entry")1 Contract Next Bar Market; 



Buy 2 shares within the next bar on the first tick with a price of 100 or less: 

Buy 2 Shares Next Bar At 100 Limit; 



Buy 10 contracts within the next bar on the first tick with a price of 50 or more: 

Buy 10 Contracts Next Bar 50 Stop; 
As you can see, you can label each order.

Mike




We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on X Visit my NexusFi Trade Journal Reply With Quote
Thanked by:




Last Updated on October 16, 2010


© 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