Skip to content

Instantly share code, notes, and snippets.

@afifhusnul
Created October 15, 2019 23:01
Show Gist options
  • Save afifhusnul/56591a41a238cf380fed59aaf425baeb to your computer and use it in GitHub Desktop.
Save afifhusnul/56591a41a238cf380fed59aaf425baeb to your computer and use it in GitHub Desktop.
/*
Pit Strategy
Author: Mahfudh
Email: [email protected]
*/
//Inputs
Lookback=60;
Baseline=50;/* jangan diganti*/
PerCent=95;
Pds =14;
Lap1 = 20;
Lap2 = 50;
Lap3 = 70;
start = 0;
finish = 100;
/* rumus */
b=( ( C+2.25 * StDev( C,20 ) - MA( C,20 ) ) / ( 4 * StDev( C,20 ) ) ) * 100;
/*Input */
Osc=b;
/*Value of Osc*/
Value1 = Osc;
/*Nilai tertinggi dan terendah dari Osc selama masa dalam period*/
Value2 = HHV(Value1,Lookback);
Value3 = LLV(Value1,Lookback);
/*Range of Osc during Lookback Period*/
Value4 = Value2 - Value3;
/*Define PerCent of Range to determine OB AND OS levels*/
Value5 = Value4 * (PerCent / 100);
/*Calculate OB AND OS levels*/
Value6 = Value3 + Value5;
Value7 = Value2 - Value5;
baseline=IIf( Osc < 100 ,50 ,IIf( Osc < 0 ,0,0));
// Plot pada graph
Plot( b, "( Pit Area )", ParamColor("Color", colorWhite ), ParamStyle("Style", styleLine) );
Plot(Lap1,"(Lap1)",17,1+4);
Plot(Lap2,"(Lap2)",17,1+4);
Plot(Lap3,"(Lap3)",17,1+4);
Plot(start,"(start)",3,1+4);
Plot(finish,"(finish)",3,1+4);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment