Manfred![]() Veteran ![]() ![]() Posts: 210 Joined: 4/2/2006 Location: South Africa ![]() | Hi, JD explained the concept just fine but being new am guessing you're looking for someone to help connect a few more of the dots :-) I dont have BasingInd() on my system so cannot test with that specifically. Also your initial example of RSI contradicts your later question of 0 crossing. RSI in its normal format ranges between 0 and 100 so you wont get zero crossings with that. Something like MACD indicator however, does have both positive and negative values so I'll use this for my worked example. Thus to show a zero crossing with MACD on your focus list do something like this: Right mouse click in focus list -> Add Omniscript column Give it a name - e.g. MACDzerocrossing or whatever you wish to call it In the Formula text box enter the Boolean condition you wish to test validity for. e.g. for a zero crossing from the downside to the upside and vice versa you'd need something like. ( MACD(12,26) > 0 AND MACD(12,26)[1] >= 0 ) OR ( MACD(12,26) < 0 AND MACD(12,26)[1] <= 0 ) In your case you probably just need to replace all instances of my MACD(12,26) above with your BasingInd(250,2,14) and in theory it should work. Anyway getting back to the MACD example, if you look at the attached png, you will see a 0 in the Omniscript column in the focuslist. This means the condition is true for the current bar. If it was false then the column would show -1. You can corroborate this by adding the same indicator to a chart and reading the value as shown on the example png. Assuming you use EOD daily data, I'll use the example of "today" and "yesterday" [1] below. For RT data substitute these terms with "current bar" and "previous bar", respectively. In English what this is doing is checking whether today's value of the indicator MACD(12,26) is greater than > 0 AND also whether yesterday's value for the indicator was greater than or equal to >=0 This fulfils the condition when the indicator crosses from below to *above* the 0 line. However, since the indicator could also conceivably cross from above to *below* the zero line you'll need to check for this too. This is the second part of the condition after the OR statement. You put OR there because you want either of the conditions to be valid and dont care which one - its a zero crossing either way. The rest of the condition is simply the reverse logic to the previous. i.e. you swap around the < and <= operators for the alternative crossover condition. You then encapsulate/group each check condition in additional parentheses ( ) so that each side of the OR operand is evaluated in full before the other side of the OR is tested for. In pseudocode it implies this: (Condition 1 part a AND Condition 1 part b) OR (Condition 2 part a AND Condition 2 part b) Stated another way: ( Indicator value today >0 AND Indicator value yesterday[1] >=0 ) OR ( Indicator value today <0 AND Indicator value yesterday[1] <=0 ) You will get invalid results on a zero crossing if you don't use this approach to group the logic statements. Hope this helps Cheers [Edited by Manfred on 1/12/2019 12:53 PM] ![]() |