+91-0000000000

}

Monday – Friday : 9:00 AM – 6:30 PM

Live More Secret Market Key

The ‘Live More Secret Market Key’ AFL might indicate a comprehensive tool or indicator designed to unlock or decipher market trends and patterns. Utilizing the Amibroker data feed, it could provide traders with key insights or signals essential for navigating the markets effectively.

/
//------------------------------------------------------------------------------
//  Formula Name   : Project Freedom - Jesse Livermore Secret Market Key
//  Author         : KH Tang 
//  Date Updated   : 30 Apr 2007 
//  Origin         : Personal Study and Understanding of Livermore's work
//  Version        : 1.0 
//------------------------------------------------------------------------------

/*
//------------------------------------------------------------------------------
Program Overview

This program classifies price action into the following states based upon rules 
his book - "How to Trade in Stocks"

StateNo1 - Up Trend
StateNo2 - Nat Rally
StateNo3 - Sec Rally
StateNo4 - Dn Trend
StateNo5 - Nat React
StateNo6 - Sec React

State change is determined by a user specified threshold of price change.
The program also determines a number of pivot points:

UpTrendPP  - Peak Up Trend Price
NatRallyPP - Peak Nat Rally Price
DnTrendPP  - Bottom Dn Trend Price
NatReactPP - Bottom Nat React Price

This program may be used as a basis for a number of studies:
- trend paint bars,
- pivot price indicator lines
- strategies (trend following AND/OR breakout/breakDn)

for a detailed explanation of the system Jesse Livermore Orginal Work.
 Note: Livermore's system used a threshold of 6 points for stocks priced 
 over $30.
//------------------------------------------------------------------------------
*/

// General Graphic Control
GraphXSpace = 15;

SetChartBkGradientFill( ParamColor("BgTop", colorWhite),
        ParamColor("BgBottom", colorSkyblue),ParamColor("titleblock",colorWhite));

ThresholdPercentValue = Param("Threshold in Percent units",10,4,15,1);
 
for( i=0; i=C[i-1])
		{//Price Move Up
			if(C[i]>UpTrend[i])
			{
				StateNo[i]=1;//Remain in UpTrend - 1111111111111111111111111111111
				InUpTrend[i]=True;
				InDnTrend[i]=False;
				UpTrend[i]=C[i];
			}
		}//End of Price Move Up
		else
		{//Price Move Dn
			if((InDnTrend[i] AND C[i]C[i-1])
		{//Price Move Up
			if(	(InUpTrend[i] AND C[i]>UpTrendPP[i]) OR
				(InDnTrend[i] AND C[i]> DnTrend[i]*(1+2*ThresholdPct[i])) )
			{//Price move to UpTrend - 1111111111111111111111111111111111111111111
				StateNo[i]=1;
				InUpTrend[i]=True;
				InDnTrend[i]=False;
				UpTrend[i]=C[i];
			}//End of Price Move to UpTrend
			else
			{
				if(C[i]>NatRally[i])
				{//Price Continue to move to higher NatRally 
					StateNo[i]=2;//Remain in NatRally - 222222222222222222222222222
					NatRally[i]=C[i];
					NatRallyReset[i]=False;
				}//End of Price Continue to move to higher NatRally
			}
		}//End of Price Move Up
		else //of(C[i]>C[i-1]) 
		{//Price Move Dn
			if((InDnTrend[i] AND C[i]C[i-1])
		{//Price Move Up
			if(	(InUpTrend[i] AND C[i]>UpTrendPP[i]) OR
				(InDnTrend[i] AND C[i]> DnTrend[i]*(1+2*ThresholdPct[i])) )
			{//Price move to UpTrend - 1111111111111111111111111111111111111111111
				StateNo[i]=1;
				InUpTrend[i]=True;
				InDnTrend[i]=False;
				UpTrend[i]=C[i];
			}//End of Price Move to UpTrend
			else
			{
				if(C[i]>NatRally[i])
				{//Price Continue to move to higher NatRally 
					StateNo[i]=2;//Remain in NatRally - 222222222222222222222222222
					NatRally[i]=C[i];
					NatRallyReset[i]=False;

				}//End of Price Continue to move to higher NatRally
				else
				{//Remain at SecRally State
					if(C[i]>SecRally[i])
					{//New Higher Sec Price - 3333333333333333333333333333333333333
						StateNo[i]=3;//Remain in SecRally State
						SecRally[i]=C[i];//Update new higher price
					}//End of New Higher Sec Price
				}//End of Remain at Sec State
			}
		}//End of Price Move Up
		else //of(C[i]>C[i-1]) 
		{//Price Move Dn
			if((InDnTrend[i] AND C[i]C[i-1])
		{//Price Move Up
			if(	(InUpTrend[i] AND C[i]>UpTrendPP[i]) OR
				(InDnTrend[i] AND C[i]> DnTrend[i]*(1+2*ThresholdPct[i])) )
			{//Price move to UpTrend - 1111111111111111111111111111111111111111111
				StateNo[i]=1;
				InUpTrend[i]=True;
				InDnTrend[i]=False;
				UpTrend[i]=C[i];
			}//End of Price Move to UpTrend
			else
			{
				if(C[i]>(SecReact[i]*(1+ThresholdPct[i])))
				{//Raise Above Current State React 
					if(C[i]>NatRally[i])
						{
							StateNo[i]=2;//Move to NatRally - 2222222222222222222222
							NatRally[i]=C[i];
							NatRallyReset[i]=False;
						}
					else
						{//Raise to SeconaryRally
							StateNo[i]=3;//Raise to SecRally - 333333333333333333333
							SecRally[i]=C[i];
						}//End of Raise to SecRally
				}// End of Raise Above Current State React
			}
		}//End of Price Move Up
		else //of(C[i]>C[i-1]) 
		{//Price Move Dn
			if((InDnTrend[i] AND C[i]C[i-1])
		{//Price Move Up
			if(	(InUpTrend[i] AND C[i]>UpTrendPP[i]) OR
				(InDnTrend[i] AND C[i]> DnTrend[i]*(1+2*ThresholdPct[i])) )
			{//Price move to UpTrend - 1111111111111111111111111111111111111111111
				StateNo[i]=1;
				InUpTrend[i]=True;
				InDnTrend[i]=False;
				UpTrend[i]=C[i];
				NatReactPP[i]=NatReact[i];
			}//End of Price Move to UpTrend
			else
			{
				if(C[i]>(NatReact[i]*(1+ThresholdPct[i])))
				{//Raise Above Current State React 
					if(NatRallyReset[i] OR C[i]>NatRally[i])
						{
							StateNo[i]=2;//Move to NatRally - 2222222222222222222222
							NatRallyReset[i]=False;
							NatRally[i]=C[i];
							NatReactPP[i]=NatReact[i];
						}
					else
						{//Raise to SeconaryRally
							StateNo[i]=3;//Raise to SecRally - 333333333333333333333
							SecRally[i]=C[i];
							NatReactPP[i]=NatReact[i];
						}//End of Raise to SecRally
				}// End of Raise Above Current State React
			}
		}//End of Price Move Up
		else //of(C[i]>C[i-1]) - Common with State 1
		{//Price Move Dn
			if((InDnTrend[i] AND C[i]C[i-1])
		{//Price Move Up
			if(	(InUpTrend[i] AND C[i]>UpTrendPP[i]) OR
				(InDnTrend[i] AND C[i]> DnTrend[i]*(1+2*ThresholdPct[i])) )
			{//Price move to UpTrend - 1111111111111111111111111111111111111111111
				StateNo[i]=1;
				InUpTrend[i]=True;
				InDnTrend[i]=False;
				UpTrend[i]=C[i];
				DnTrendPP[i]=DnTrend[i];
			}//End of Price Move to UpTrend
			else
			{
				if(C[i]>(DnTrend[i]*(1+ThresholdPct[i])))
				{//Raise Above Current State React 
					if(NatRallyReset[i] OR C[i]>NatRally[i])
						{
							StateNo[i]=2;//Move to NatRally - 2222222222222222222222
							NatRallyReset[i]=False;
							NatRally[i]=C[i];
							DnTrendPP[i]=DnTrend[i];
						}
					else
						{//Raise to SeconaryRally
							StateNo[i]=3;//Raise to SecRally - 333333333333333333333
							SecRally[i]=C[i];
							DnTrendPP[i]=DnTrend[i];
						}//End of Raise to SecRally
				}// End of Raise Above Current State React
			}
		}//End of Price Move Up
		else //of(C[i]>C[i-1]) - Common with State 1
		{//Price Move Dn
			if(C[i] DnTrend[i]*(1+2*ThresholdPct[i]) )   
	{
		NatRallyReset[i]=True;
	}

  }  //end; //{main}
} //End of For i Loop!

//Plotting Section - Just for testing

//InUpTrend
WeightNo= IIf(StateNo==1,5,  // UpTrend
			IIf(StateNo==2,3,  // and NatRally
			IIf(StateNo==3,1,  // and SecRally
			IIf(StateNo==4,-1,  // and SecReact
			IIf(StateNo==5,-3,  // and NatReact
			IIf(StateNo==6,-5, // DownTrend
			                0  // and SecReact
			))))));

Plot(WeightNo,"Livermore Market Key Stage",IIf(WeightNo>0 AND WeightNo==5,colorGreen,
                         IIf(WeightNo>0,colorBlue,
							 IIf(WeightNo<0 AND WeightNo==-5,colorRed,colorOrange))),styleStaircase|styleDots);


//End of Livermore Market Key Section



Plot(0,"",colorBlack);
Plot(6,"",colorWhite);
Plot(-6,"",colorWhite);

Buy = WeightNo==5;
Sell= WeightNo<5;

Short= WeightNo==-5;
Cover= WeightNo>-5;

Buy=ExRem(Buy,Sell);
Sell=ExRem(Sell,Buy);

Short=ExRem(Short,Cover);
Cover=ExRem(Cover,Short);


Open chat
1
Hi, how can I help you?