NexusFi: Find Your Edge


Home Menu

 





Counting Orders


Discussion in EasyLanguage Programming

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




 
Search this Thread

Counting Orders

  #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?
PowerLanguage & EasyLanguage. How to get the platfor …
EasyLanguage Programming
How to apply profiles
Traders Hideout
REcommedations for programming help
Sierra Chart
MC PL editor upgrade
MultiCharts
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
 
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
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,433 since Apr 2013
Thanks Given: 481
Thanks Received: 1,627


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 Twitter 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,433 since Apr 2013
Thanks Given: 481
Thanks Received: 1,627

tradestation18,

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

Regards,

ABCTG

Follow me on Twitter Reply With Quote
Thanked by:




Last Updated on September 27, 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 - Downloads - Top
no new posts