Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

RealCode - Pulling the prior condition given another conditions occurance Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
cortner
Posted : Monday, July 28, 2014 3:25:34 PM
Registered User
Joined: 4/13/2014
Posts: 11

Bruce,

I am trying to create a condition that passes when the price increases based on two other conditions that are not price relevant.

See Image: The White arrow reflects my OUT condition and the Pink arrow reflects my IN condition based on my AVG UP/DOWN Days %21 chart.

The problem is I need to base my realcode to first locate the OUT condition and then look to find the previous IN condition so that I can pull the price difference between the two points.

In the image example, itf I wrote the code right, the IN price would be 13.81 (date 4/29/14) and the OUT price would be 14.7 (date 6/3/14). 

Here is my current code:::

'# IN = chartCondition.INTOSLUMP
'# OUT = chartCondition.UPOUTOFSLUMP
Static PriceOut As Single = 0
Static PPCD As Single = 0
 
If OUT.value Then
PriceOut = price.Close
End If
 
If IN.value Then
PriceIn = price.close
End If
 
If PriceOut > PriceIn Then pass
 
================
Any help would be much appreciated!

 

Bruce_L
Posted : Monday, July 28, 2014 3:51:28 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

I tried to keep the alterations to your RealCode to a minimum.

'# ValidName = chartCondition.INTOSLUMP
'# OUT = chartCondition.UPOUTOFSLUMP
Static PriceOut As Single
Static PriceIn As Single

If isFirstBar Then
	PriceOut = 0
	PriceIn = 0
End If
 
If OUT.value Then
	PriceOut = price.Close
End If
 
If ValidName.value Then
	PriceIn = price.close
End If
 
If PriceOut > PriceIn Then pass


-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Users browsing this topic
Guest-1

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.