NexusFi: Find Your Edge


Home Menu

 





Counting Orders


Discussion in EasyLanguage Programming

Updated
    1. trending_up 1,636 views
    2. thumb_up 2 thanks given
    3. group 2 followers
    1. forum 4 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

I would like to set a simple code to place up to 5 orders sequencially, not in the same bar but the number of orders would be a changeable input, that is, a range of maximum orders could be defined.
I designed the code below but it doesnt work nor does any counting...Can someone help me on this?
Thanks

Inputs:
Price( Close ), PositionBasis( False ),Entrysize (1000),
Ci(12),
ptsROC(0.5), MaxROC(3) ;

variables:
EntryCondition1(false),

CountROC (0);

EntryCondition1= Close > Ci ;

if MarketPosition = 0 then begin
CountROC = 0 ;
end ;

if CurrentBar > 1 then begin


if EntryCondition1 then
Switch( CurrentContracts )
begin
Case 0:
Buy ("MACDLE1") this bar at Close;
if CountROC < MaxROC then
begin
CountROC += 1 ;
end;
Buy ("MACDLE2") this bar at Close;
if CountROC < MaxROC then
begin
CountROC += 1 ;
end;
Case EntrySize*2:
Buy ("MACDLE3") this bar at Close;
if CountROC < MaxROC then
begin
CountROC += 1 ;
end;
Case EntrySize*3:
Buy ("MACDLE4") this bar at Close;
if CountROC < MaxROC then
begin
CountROC += 1 ;
end;
Case EntrySize*4:
Buy ("MACDLE5") this bar at Close;
end;
end;


sell ("MACDLX1") from entry ("MACDLE1") next bar AT$ Close + PTSroc Limit ;
sell ("MACDLX2") from entry ("MACDLE2") next bar AT$ Close + PTSroc Limit ;
sell ("MACDLX3") from entry ("MACDLE3") next bar AT$ Close + PTSroc Limit ;
sell ("MACDLX4") from entry ("MACDLE4") next bar AT$ Close + PTSroc Limit ;
sell ("MACDLX5") from entry ("MACDLE5") next bar AT$ Close + PTSroc Limit ;


Reply With Quote

Can you help answer these questions
from other members on NexusFi?
CFTC Requests Tag 50 Trader Identity Data From CME and I …
Traders Hideout
CFTC Rewrites the Rulebook -- Kalshi Cracks $1B Non-Spor …
Prediction Markets & Event Contracts
Energy Futures Shatter All-Time Daily Volume: 8.3 Millio …
Commodities
More Than Capable: Hegseths War Warning Validates $114M …
Prediction Markets & Event Contracts
One Wallet Made $200K in Hours: AP Probes Polymarket Cea …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
21 thanks
2026 Jlab journal
10 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Lady Vols Primer: Trading Volatility Journal
6 thanks
Trying to learn Volume and price action correlation
5 thanks
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,447 since Apr 2013
Thanks Given: 493
Thanks Received: 1,639


tradestation18,

I would suggest using the Print statements to find out if certain parts are executed. Check if the entry conditions are fulfilled at all.
When you say "doesn't work" what does the code do versus what do you want it to do?

Regards,

ABCTG


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

Thanks. The code doesnt work because the supposed counting of entry orders simply doesnt work. There is no counting. I would like to limit the number of entries for each EntryCondition, but this routine doesnt seem to count anyway...


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

tradestation18,

what do the print statements show, does the code cycle through all parts?

Regards,

ABCTG


Follow me on X Reply With Quote
Thanked by:




Last Updated on September 27, 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