NexusFi: Find Your Edge


Home Menu

 





unable to use barssinceexit(1) but able to print it


Discussion in MultiCharts

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




 
Search this Thread
  #1 (permalink)
Dvdkite
Trieste Italy
 
Posts: 162 since Feb 2018
Thanks Given: 131
Thanks Received: 25

Hello,

I'm basically trying to avoid an entry if there was already an entry closed in the previous bar. So just to be sure I decided the avoid entries at least for 3 bars after the last trade so I made this code:

 
Code
if (EntriesToday(Date) > 0 = true) then begin

		if barssinceexit(1) > 3 then canEntry= true else canEntry= false;
		if barstatus = 2 then print("barssinceexit(1) = ", barssinceexit(1));
		
    end;
	
 if marketposition = 0 and canEntry then begin

The problem is that by adding "canEntry" in the " if marketposition = 0 and canEntry then begin" the strategy doesn't perform any trade. By removing canentry the backtest is showing 731 trade.
Ok so I tryied to print barssinceexit(1) and it work!!!!! It is correclty showing values in the Output as this exampe:

 
Code
barssinceexit(1) =    0.00
barssinceexit(1) =    1.00
barssinceexit(1) =    2.00
barssinceexit(1) =    3.00
barssinceexit(1) =    4.00
barssinceexit(1) =    5.00
barssinceexit(1) =    6.00
barssinceexit(1) =    7.00
barssinceexit(1) =    8.00
barssinceexit(1) =    9.00
barssinceexit(1) =   10.00
barssinceexit(1) =   11.00
barssinceexit(1) =   12.00
barssinceexit(1) =   13.00

So if I'm able to PRINT it then barssinceexit(1) HAS a value and why my code is basically never doing a trade? --------> Why canEntry is always false?

Any help would be appreciated.

Thanks

David


Reply With Quote




Last Updated on November 20, 2019


© 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