[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Re[2]: Simple question



PureBytes Links

Trading Reference Links

OK here is the crux of the problem .. I am trying to calculate a Trend line
using the standard firmula but inserting the swing high bars and points to
get it .. so I wrote:
Brkpoutlevel=TLValue(SwingHigh(1, High, Entrylkbk, 99),
	                 SwingHighBar(1, High, Entrylkbk, 99),
                     SwingHigh(0, High, Entrylkbk, 99),
					 SwingHighBar(0, High, Entrylkbk,
99),
		       		 SwingHighBar(0, High, Entrylkbk, 99)+1);
But this is flawed somehow .. Does anyone know how to fix it..
-----Original Message-----
From: Jimmy Snowden [mailto:jhsnowden@xxxxxxxxxxxxx] 
Sent: Friday, August 26, 2005 9:10 AM
To: Chris Evans
Subject: Re[2]: Simple question

 I think that is over my head.  It would take me a lot of time to
 figure out what to use in the code.  There are some really smart guys
 on the list.  Ask again what to use.  Tell them exactly what you
 want.

 Jimmy


Actually I'd like to use the values as breakout levels to test so I need to
call the values in a strategy...

-----Original Message-----
From: Jimmy Snowden [mailto:jhsnowden@xxxxxxxxxxxxx] 
Sent: Thursday, August 25, 2005 6:02 PM
To: Chris Evans; Omega-List
Subject: Re: Simple question

When you see commentary then you can easily and quickly access the
value for any bar.  Add the tool to your tool bar "Expert Commentary"
then click on it to bring up a box with the values.  The icon looks
like a graduation cap.

I didn't look at the code closely so I am assuming you want the values
in the Commentary at the bottom.

Jimmy


So if this my trend line indicator code: 

{*******************************************************************
Description	: This Indicator plots TrendLines-Automatic
Provided By	: Omega Research, Inc. (c) Copyright 1999 
********************************************************************}

Inputs: RHStren(4), RLStren(4), History("No"), RHColor("Red"),
RLColor("Blue"), AlrtType("IntraBar");;
Variables: RHTLRef(-1), RHTLRef2(-1), RHSet(-1), RHSet2(-1), RHArrayVal(0),
RHColorVar(0), RLColorVar(0), BarsPast(0);
Variables: RLTLRef(-1), RLTLRef2(-1), RLSet(-1), RLSet2(-1),RLArrayVal(0),
RHTLBrk(False), RLTLBrk(False);
Arrays: RHDate[10](0), RHTime[10](0), RHVal[10](0);
Arrays: RLDate[10](99999), RLTime[10](99999), RLVal[10](99999);

If currentbar=1 Then Begin
	BarsPast = 10;
	RHColorVar = StrColortoNum(RHColor);
	RLColorVar = StrColortoNum(RLColor);
End;

If SwingHighBar(1, High, RHStren, RHStren+1)=RHStren Then Begin
	For Value1 = 9 DownTo 0 Begin
		RHDate[Value1+1] = RHDate[Value1];
		RHTime[Value1+1] = RHTime[Value1];
		RHVal[Value1+1] = RHVal[Value1];
	End;
	RHDate[0] = Date[RHStren];
	RHTime[0] = Time[RHStren];
	RHVal[0] = High[RHStren];

	For Value22 = 1 To 10 Begin
		If RHVal[Value22] > RHVal[0] Then Begin
			RHArrayVal = Value22;
			Value22 = 11;
		End;
	End;

	If Value22 <> 11 Then Begin
		If RHSet >= 0 Then Begin
			If UpperStr(History) = "YES" or UpperStr(History) =
"Y" Then Begin
				If RHTLBrk = False Then 
					RHTLRef2 = TL_SetEnd(RHTLRef,
Date,Time, TL_GetValue(RHTLRef, Date, Time));
				RHSet2 = TL_SetExtRight(RHTLRef, False);
			End
			Else 
				TL_Delete(RHTLRef);
		End;
		RHTLBrk = False;
		RHTLRef = TL_New(RHDate[RHArrayVal], RHTime[RHArrayVal],
RHVal[RHArrayVal], RHDate[0], RHTime[0], RHVal[0]);
		{Error checking To make sure TL was drawn}
		If RHTLRef >= 0 Then Begin
			RHSet = TL_SetExtRight(RHTLRef, True);
			If RHColorVar <> 99 Then 
				Value14 = TL_SetColor(RHTLRef, RHColorVar);
		End;
		If False Then 
			Plot1[RHStren](High[RHStren], "RH ");
	End;
End;

If SwingLowBar(1, Low, RLStren, RLStren+1) = RLStren Then Begin
		For Value1 = 9 DownTo 0 Begin
				RLDate[Value1+1] = RLDate[Value1];
				RLTime[Value1+1] = RLTime[Value1];
				RLVal[Value1+1] = RLVal[Value1];
		End;
		RLDate[0] = Date[RLStren];
		RLTime[0] = Time[RLStren];
		RLVal[0] = Low[RLStren];

		For Value22 = 1 To 10 Begin
			If RLVal[Value22] < RLVal[0] Then Begin
				RLArrayVal = Value22;
				Value22 = 11;
			End;
		End;
		If Value22 <> 11 Then Begin
			If RLSet >= 0 Then Begin
				If (UpperStr(History) = "YES" or
UpperStr(History) = "Y")  Then Begin
					If RLTLBrk = False Then 
						RLTLRef2 =
TL_SetEnd(RLTLRef, Date, Time, TL_GetValue(RLTLRef, Date, Time));
					RLSet2 = TL_SetExtRight(RLTLRef,
False);
				End
				Else 
					TL_Delete(RLTLRef);
			End;
			RLTLBrk = False;
			RLTLRef = TL_New(RLDate[RLArrayVal],
RLTime[RLArrayVal], RLVal[RLArrayVal], RLDate[0], RLTime[0], RLVal[0]);
			{Error checking To make sure TL was drawn}
			If RLTLRef >= 0 Then Begin
				RLSet = TL_SetExtRight(RLTLRef, True);
				If RLColorVar <> 99 Then 
					Value14 = TL_SetColor(RLTLRef,
RLColorVar);
			End;
			If False Then 
				Plot2[RLStren](Low[RLStren],"RL ");
		End;
End;

If RHSet[BarsPast] >= 0 AND Close[BarsPast] Crosses Over
TL_GetValue(RHTLRef, Date[BarsPast], Time[BarsPast]) Then Begin
	RHTLRef2 = TL_SetEnd(RHTLRef, Date, Time, TL_GetValue(RHTLRef, Date,
Time));
	RHTLBrk = True;
End;

If RLSet[BarsPast] >= 0 AND Close[BarsPast] Crosses Below
TL_GetValue(RLTLRef, Date[BarsPast], Time[BarsPast]) Then Begin
	RLTLRef2 = TL_SetEnd(RLTLRef, Date, Time, TL_GetValue(RLTLRef, Date,
Time));
	RLTLBrk = True;
End;

If CheckAlert Then Begin
	If RHSet >= 0 AND UpperStr(AlrtType) = "ONCLOSE" Then 
		TL_SetAlert(RHTLRef, 2)
	Else
		If RHSet >= 0 AND  UpperStr(AlrtType) = "INTRABAR" Then 
			TL_SetAlert(RHTLRef, 1)
		Else
			If RHSet >= 0 Then 
				TL_SetAlert(RHTLRef, 0);

	If RLSet >= 0 AND UpperStr(AlrtType) = "ONCLOSE" Then 
		TL_SetAlert(RLTLRef, 2)
	Else
		If RLSet >= 0 AND  UpperStr(AlrtType) = "INTRABAR" Then 
			TL_SetAlert(RLTLRef, 1)
		Else
			If RLSet >= 0 Then 
				TL_SetAlert(RLTLRef, 0);
End;


Commentary("RHValue=",RHVal[0],newline,"RLValue=",RLVal[0]);
*********************************************************


And I want to know the value today of the trend line (going up or down) then
what is the variable that gives me that value - or do I need to write one?

CJE