NexusFi: Find Your Edge


Home Menu

 





Counting Orders


Discussion in EasyLanguage Programming

Updated
    1. trending_up 1,653 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?
Iran Fired a Missile at Israel Last Night. The $8M June …
Prediction Markets & Event Contracts
CME Cuts Precious Metals Margins Up to 21% Starting Toda …
Commodities
Powell in 48 Hours: Word Markets Give 78% on Inflation, …
Prediction Markets & Event Contracts
April Jobs Beat Flips Fed Hike Odds Past 52% for First T …
Traders Hideout
Rubios Good News Within Hours and the 30-Day Math: Why H …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Big Mike in Ecuador
197 thanks
Sober Journey With S&P
27 thanks
30 Sessions
20 thanks
Volume Indicators
8 thanks
BERN ALGOS algo trading journal
8 thanks
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,448 since Apr 2013
Thanks Given: 494
Thanks Received: 1,642


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,448 since Apr 2013
Thanks Given: 494
Thanks Received: 1,642

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