OmniTrader Professional Forum OmniTrader Professional Forum
forums calendars search
today this week
register logon control panel Forum Rules
You are currently browsing as a guest.
You should logon to access more features
A Self-Moderated Community - ALL MEMBERS, PLEASE READ!
Vote for Members who contribute the most to your trading, and help us moderate content within the Forums.

  Current location        Thread information  
OmniTrader Professional Forum
Feature Requests
Please add a DebugLof() function
Last Activity 2/29/2020 8:00 PM
1 replies, 230 viewings

Jump to page : 1
Now viewing page 1 [25 messages per page]
back reply
Printer friendly version

^ Top

Posts: 108

Joined: 9/12/2007
Location: Valley Center, CA

User Profile
Subject : Please add a DebugLof() function
Posted : 6/7/2019 2:00 PM
Post #30445

I am attaching an indicator that contains code that writes to a disk file.

The intention of this code is to aid in debugging and exporting information to Excel. I believe this is very useful to any developer.

The rub is that it takes several lines of code to open, write or print, then close the disk file.

I am asking that similar logic be put into a DebugLog() function, accessible anywhere within OL, just like the DebugMsg() function.

Either hard code a known path to the Log file, or allow an extra parameter to specify the path to the log file. Or provide one more function to change the path from the default, hard coded one.

This will allow text to be logged via a single line of OL code, versus multiple lines of VB.NET code.

Thanks for your consideration.

Attached file : indTestWriteToFile.txt (1KB - 45 downloads)

^ Top

Posts: 108

Joined: 9/12/2007
Location: Valley Center, CA

User Profile
Subject : RE: Please add a DebugLof() function
Posted : 6/7/2019 9:52 PM
Post #30448 - In reply to #30445

I am attaching a OL file called funDebugLog.txt.

I call it "fun" because it is intended to be a function call. It is coded as a #indicator because OL doesn't support functions.

Earlier today I wrote some test code that used 5 "fun" #indicators to call each other from a indicator intended to actually be an indicator. IE it actually ploted stuff to the chart and was intended to be called once per bar. I was able to nest 5 "fun" #indicators deep. The only issue is that since "fun"ctions are still #indicators, OT calls every "Fun"ction on every bar, even though I really just wanted the "fun"ction called once.

Why am I explaining this? Because it is important to understanding funDebugLog().

In order to get funDebugLog() to only print one line to the output file, I needed to pass the Bar on which it is called as a Param. Then I check within funDebugLog() such that I only process the print to file logic on said bar.

So, funDebugLog() takes 3 params. Bar is as just described. The second param is an enumeration that specifies what type of event is being logged. (Entry, Stop, or Exit) The last param is the Level (price) where the event should have taken place.

Invoking FunDebugLog() from a #system or #stop is as follows -


' use this in a Systems block to generate a long signal on 4/1/2019
' use the stoTestVirtualLimitStop in the Trade Plan block
' run the strategy on APPL
' I am supplying the trategy, system, stop, and trade plan
' so Nirvana tech support can reproduce the bug...

if BarYear() = 2019 AND BarMonth() = 4 AND BarDayOfMonth() = 1 then
Signal = LongSignal
funDebugLog( Bar, 1, C )
end if

Note - there is no way to have a #param that is a string. This sucks. It would be far better to allow #params to be typed. IE

#param Periods as integer = 14, 5, 50


#para Msg as string = "How is life?", "life sucks", "life is great"

Ok, maybe min and max values on string is over the top...

Note - support a #function that only was invoked once when called upon would be a great benefit in building reusable and maintainable code. Factoring big problems into many small, easily grasped mini problems is what good coding is all about.

Note - I REALLY miss enumerations. How about #defines? Anything other than using an integer and commenting what it means in the code...

Enough whinging…

Attached file : funDebugLog.txt (1KB - 42 downloads)
Attached file : funDebugLog.txt (1KB - 43 downloads)

Jump to page : 1
Now viewing page 1 [25 messages per page]
back reply

Legend    Action      Notification  
Forum Moderator
Registered User
Unregistered User
E-Mail this thread to a friend
Toggle e-mail notification

Nirvana Systems
For any problems or issues please contact our Webmaster at