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.


Only Forum Moderators, Administrators, and the owner of this message may delete it.

 
Jim Dean

Sage
2000100010010010010025
Posts: 3433

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

User Profile
 
Subject : RE: OL for Crossing above or Crossing below
Posted : 12/26/2018 9:29 AM
Post #30217 - In reply to #30216

Hi, Daniel

You need to do two tests ... the condition for the prior bar vs the condition for the current bar. For example:

if C[1] < SMA(20)[1] and C > SMA(20) then
... code for long crossover actions
elseif C[1] > SMA(20)[1] and C < SMA(20) then
... code for short crossover actions
end if


[Edited by Jim Dean on 12/26/2018 9:30 AM]

Deleting message 30217 : RE: OL for Crossing above or Crossing below


Nirvana Systems
For any problems or issues please contact our Webmaster at webmaster@nirvsys.com.