NexusFi: Find Your Edge


Home Menu

 





Restricting number of long/short trades on multicharts?


Discussion in EasyLanguage Programming

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




 
Search this Thread

Restricting number of long/short trades on multicharts?

  #1 (permalink)
Fudgester
Mumbai + India
 
Posts: 8 since Aug 2020
Thanks Given: 2
Thanks Received: 0

Hey guys,

I was wondering if there are any keywords in multicharts to restrict the number of long trades and short trades taken in a day to 1?

I tried using maxtrades, but it just limits all the trades. So on a day if long has been triggered twice, then we end up taking them and ignoring the upcoming short trades.


Anyone?

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
REcommedations for programming help
Sierra Chart
Better Renko Gaps
The Elite Circle
Quant vue
Trading Reviews and Vendors
ZombieSqueeze
Platforms and Indicators
What broker to use for trading palladium futures
Commodities
 
  #2 (permalink)
Kolnidrei
Lyon/France
 
Posts: 23 since Aug 2012
Thanks Given: 1
Thanks Received: 14

I'm afraid you can't achieve this with a simple keyword
but you will need to apply a code similar to this one :

 
Code
Inputs:
Longs(1),
Shorts(1);
Vars:
MP(0),LongsCounter(0),ShortsCounter(0),Longsignal(false),Shortsignal(false);

MP = Marketposition;
if Date <> Date[1] then begin
LongsCounter = 0;
ShortsCounter = 0;
end;
If MP = 1 and MP[1] <> MP then LongsCounter = LongsCounter + 1;
If MP = -1 and MP[1] <> MP then ShortsCounter = ShortsCounter + 1;
Longsignal = O > H[1];
Shortsignal = O < L[1];
If Longsignal and LongsCounter < Longs then buy next bar at market;
If Shortsignal and ShortsCounter < Shorts then short next bar at market;

Reply With Quote
Thanked by:
  #3 (permalink)
Fudgester
Mumbai + India
 
Posts: 8 since Aug 2020
Thanks Given: 2
Thanks Received: 0



Kolnidrei View Post
I'm afraid you can't achieve this with a simple keyword
but you will need to apply a code similar to this one :

 
Code
Inputs:
Longs(1),
Shorts(1);
Vars:
MP(0),LongsCounter(0),ShortsCounter(0),Longsignal(false),Shortsignal(false);

MP = Marketposition;
if Date <> Date[1] then begin
LongsCounter = 0;
ShortsCounter = 0;
end;
If MP = 1 and MP[1] <> MP then LongsCounter = LongsCounter + 1;
If MP = -1 and MP[1] <> MP then ShortsCounter = ShortsCounter + 1;
Longsignal = O > H[1];
Shortsignal = O < L[1];
If Longsignal and LongsCounter < Longs then buy next bar at market;
If Shortsignal and ShortsCounter < Shorts then short next bar at market;

Thanks a ton kolnidrei. I was worried that this could not be possible as one of the limits of "easy language". Thanks a ton for the template. Ur a lifesaver

Reply With Quote




Last Updated on August 16, 2020


© 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