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
OmniScan
My own Olang Indicator
Last Activity 5/19/2018 1:21 PM
16 replies, 2320 viewings

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

^ Top
Duxx

Elite
50010010010025
Posts: 825

Joined: 2/18/2009

User Profile
 
Subject : My own Olang Indicator
Posted : 12/6/2011 9:41 PM
Post #20030

I feel dumb asking this question that by now I should probably know.

I have written an Olang Indicator and I want to scan with it. I tried to scan but it returns 0. And by hand I know there must be at least 100 occurences of that indicator.

I have basically written in the scan somehing along this lines:

IndOGMarket(4,65)>2

Thank you
^ Top
Jim Dean

Sage
2000100010025
Posts: 3147

Joined: 3/13/2006
Location: L'ville, GA

User Profile
 
Subject : RE: My own Olang Indicator
Posted : 12/6/2011 9:45 PM
Post #20031 - In reply to #20030

The value that the indicator plots must be Returned also.

#Indicator
Dim myval as single
Myval = SMA(6)
Plotprice("SMA",myval)
Return myval
^ Top
Duxx

Elite
50010010010025
Posts: 825

Joined: 2/18/2009

User Profile
 
Subject : RE: My own Olang Indicator
Posted : 12/6/2011 9:55 PM
Post #20032 - In reply to #20031

Hello Jim,

I think I have it that way:

#Indicator

#param "CurrATRpds", 15
#param "HistATRpds", 660

Dim RatioHistVol as Single

If Symboldata.Numrec - 1 < HistATRpds then

RatioHistVol = ATR(CurrATRpds) / ATR(Symboldata.Numrec - 1)

Else

RatioHistVol = ATR(CurrATRpds) / ATR(HistATRpds)

End If

Plot( "HistVol", RatioHistVol )
PlotLabel(2)

Return RatioHistVol

^ Top
Jim Dean

Sage
2000100010025
Posts: 3147

Joined: 3/13/2006
Location: L'ville, GA

User Profile
 
Subject : RE: My own Olang Indicator
Posted : 12/7/2011 2:08 AM
Post #20034 - In reply to #20032

Use "bar" instead of symboldata.numrec-1
^ Top
Duxx

Elite
50010010010025
Posts: 825

Joined: 2/18/2009

User Profile
 
Subject : RE: My own Olang Indicator
Posted : 12/7/2011 9:42 PM
Post #20046 - In reply to #20034

Hi Jim

Strangely, still giving me a zero after the change to bar. But Im sure there are many stocks that can be scan with that indicator.

Thx

[Edited by Duxx on 12/7/2011 9:51 PM]

^ Top
Jim Dean

Sage
2000100010025
Posts: 3147

Joined: 3/13/2006
Location: L'ville, GA

User Profile
 
Subject : RE: My own Olang Indicator
Posted : 12/8/2011 5:07 AM
Post #20048 - In reply to #20046

Post your revised code please.
^ Top
Duxx

Elite
50010010010025
Posts: 825

Joined: 2/18/2009

User Profile
 
Subject : RE: My own Olang Indicator
Posted : 12/8/2011 7:56 AM
Post #20049 - In reply to #20048

Hi Jim

I think I made a mistake but not on my computer right now to test. I left the -1 after bar - I should have just input bar - will test and post again once I get to the computer.

Thank you Jim


Here is what I input last night:
#Indicator

#param "CurrATRpds", 15
#param "HistATRpds", 660

Dim RatioHistVol as Single

If bar - 1 < HistATRpds then

RatioHistVol = ATR(CurrATRpds) / ATR(bar - 1)

Else

RatioHistVol = ATR(CurrATRpds) / ATR(HistATRpds)

End If

Plot( "HistVol", RatioHistVol )
PlotLabel(2)

Return RatioHistVol


^ Top
Jim Dean

Sage
2000100010025
Posts: 3147

Joined: 3/13/2006
Location: L'ville, GA

User Profile
 
Subject : RE: My own Olang Indicator
Posted : 12/8/2011 9:16 AM
Post #20051 - In reply to #20049

Remove both -1's.

And also wrap the whole thing in
If bar > curratrpds then
… stuff
End if
^ Top
Duxx

Elite
50010010010025
Posts: 825

Joined: 2/18/2009

User Profile
 
Subject : RE: My own Olang Indicator
Posted : 12/8/2011 9:16 PM
Post #20059 - In reply to #20051

Hi Jim

I erased the -1

Not sure I understand what you mean to wrap up the whole thing - Do you mean this?

Thank you for bearing with me

#Indicator

#param "CurrATRpds", 15
#param "HistATRpds", 660

Dim RatioHistVol as Single

If bar < HistATRpds then

RatioHistVol = ATR(CurrATRpds) / ATR(bar)

Else

RatioHistVol = ATR(CurrATRpds) / ATR(HistATRpds)

End If

Plot( "HistVol", RatioHistVol )
PlotLabel(2)

Return RatioHistVol
^ Top
Jim Dean

Sage
2000100010025
Posts: 3147

Joined: 3/13/2006
Location: L'ville, GA

User Profile
 
Subject : RE: My own Olang Indicator
Posted : 12/9/2011 5:32 AM
Post #20063 - In reply to #20051

Try this (not tested, from iPhone):

#Indicator

#param "CurrATRpds", 15
#param "HistATRpds", 660

Dim RatioHistVol as Single

If bar >= CurrATRpds then

If bar < HistATRpds then
RatioHistVol = ATR(CurrATRpds) / ATR(bar)
Else
RatioHistVol = ATR(CurrATRpds) / ATR(HistATRpds)
End If

Plot( "HistVol", RatioHistVol )
PlotLabel(2)

End if

Return RatioHistVol

[Edited by Jim Dean on 12/9/2011 5:35 AM]

^ Top
Duxx

Elite
50010010010025
Posts: 825

Joined: 2/18/2009

User Profile
 
Subject : RE: My own Olang Indicator
Posted : 12/9/2011 3:30 PM
Post #20073 - In reply to #20063

Hi Jim,

It continue to show zero on the scan.



[Edited by Duxx on 12/9/2011 3:32 PM]

Attached file : 12-9-2011 2-29-42 PM.png (6KB - 371 downloads)

^ Top
Jim Dean

Sage
2000100010025
Posts: 3147

Joined: 3/13/2006
Location: L'ville, GA

User Profile
 
Subject : RE: My own Olang Indicator
Posted : 12/9/2011 4:08 PM
Post #20074 - In reply to #20073

Check the value being used, by assigning that function to a custom focus list column.

There was an issue reported quite a while ago, where OScan was improperly interpreting some OLang functions. I *thot* it had been fixed.

Try using the "US Stocks" list for the scan. If your FL column shows a value for any symbols that is <= 1.5, and the scan does not show those symbols, you need to snapshot both screens, and bundle them with your code in a bug report.

Also it would probably be useful to show a few snaps of charts of symbols for which the plot shows <= 1.5 but the symbol does not show up in the scan.
^ Top
Duxx

Elite
50010010010025
Posts: 825

Joined: 2/18/2009

User Profile
 
Subject : RE: My own Olang Indicator
Posted : 12/9/2011 4:27 PM
Post #20076 - In reply to #20074

Thank you Jim

I posted them into the tech support folder.

Have a nice weekend
^ Top


This accout has been deleted
 
Subject : RE: My own Olang Indicator
Posted : 7/18/2015 2:53 AM
Post #23498 - In reply to #20030

I have a custom indicator that I want to use in an omniscan. What is the correct syntax?

myIndicator()?
myIndicator(Return)?
myIndicator(variable)?
^ Top
Jim Dean

Sage
2000100010025
Posts: 3147

Joined: 3/13/2006
Location: L'ville, GA

User Profile
 
Subject : RE: My own Olang Indicator
Posted : 7/18/2015 5:23 AM
Post #23499 - In reply to #23498

Myindicator(Param,param,…) depending on how many #param stmts your Indic has. It will return the Return value to the script.

If your Indic has no param's then use ()

[Edited by Jim Dean on 7/18/2015 5:25 AM]

^ Top
THOMAS HELGET

Legend
500
Posts: 513

Joined: 3/22/2006
Location: BALDWINSVILLE, NEW YORK

User Profile
 
Subject : RE: My own Olang Indicator
Posted : 7/18/2015 7:44 PM
Post #23500 - In reply to #23499

Don:

In the OmniScan you also have to provide some sort of Boolean information in relation to the values the Indicator is "Return"ing (usually that last line in your Indicator) such as:

MyIndicator(Param, Param, ....) > 5 Or

MyIndicator() = 7

I hope that further clarifies things.

Tom Helget

[Edited by THOMAS HELGET on 7/18/2015 7:46 PM]

^ Top
Jim Dean

Sage
2000100010025
Posts: 3147

Joined: 3/13/2006
Location: L'ville, GA

User Profile
 
Subject : RE: My own Olang Indicator
Posted : 7/19/2015 3:51 AM
Post #23501 - In reply to #23500

Tom is correct that is the "normal" way for a scan to be structured.

However, if the Return value from the called function is itself a true/false flag, no other Boolean operators or syntax are needed.

That is, if myindicator() returns 0, it is interpreted as "false" … if it returns -1 (or any other nonzero value), it is interpreted as "true".

Or you can combine it (as a T/F value) with other logical conditions, such as:
myindicator() And Sma(V,50) > 1e5

Click here for a pretty extensive explanation about how and why the zero and nonzero answers are treated as false and true, plus a bunch of other interesting (to some people :-) factoids regarding Boolean math in OLang and OScript.

[Edited by Jim Dean on 7/19/2015 4:05 AM]

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

Legend    Action      Notification  
Administrator
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 webmaster@nirvsys.com.