# My trades based on "new way of pivot trading" and vwap

#### rjshem

##### Well-Known Member
This is not the thread for that question.

#### vijkris

##### Learner and Follower
Dear rjshem
Which afl is this?
Regards
sorry, missed ur post.

its simple anyone with basic knowledge can code it. it just compares the close price with respect to ma 21 and ema8, in daily, hourly and 15 min timeframe.
please note: this afl should be used in analysis/exploration window.

Code:
``````// created by vijay krishna
SetChartOptions( 0,chartShowArrows+ chartShowDates |   chartWrapTitle );
//SetChartOptions(2,chartShowDates+chartWrapTitle);

Layer = Param("Layer", 0, -5, 5, 1) ;
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} " + EncodeColor( colorGreen ) + " Open %g," + EncodeColor( colorWhite ) + " Hi %g,  " + EncodeColor( colorRed ) + " Lo %g,  " + EncodeColor( colorBlue ) + " Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));

Plot( C, "Close",  colorTeal, styleNoTitle | styleCandle,0,0,0,Layer );
HiVolume = IIf(V > (2 * MA(V,10)), True, False);
PlotShapes(shapeSmallCircle * HiVolume, IIf(C > O, colorBlack, colorWhite), 0, (O+C)/2, 0);
ToolTip = "Open = " + O + "\nHigh = " + H + "\nLow = " + L + "\nClose = " + C ;

EMA5  = Prec(EMA(C,8),2);
Plot(EMA5,"ema8",ParamColor("8ema colour",colorBlue),styleNoRescale);

_SECTION_BEGIN("MA1");
periods = Param("Periods", 21, 2, 300, 1, 0 );
Plot( MA( C, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorOrange ), ParamStyle("Style") );
_SECTION_END();

_SECTION_BEGIN("timeframe");
above3 = Ref(C,-1)>EMA(C,8) AND Ref(C,-1)>MA(C,21);// previous bar bcos current bar may change color
below3 = Ref(C,-1)<EMA(C,8) AND Ref(C,-1)<MA(C,21);
text3 = WriteIf(above3,"above",WriteIf(below3,"below",""));
Color3 = IIf(above3,colorPaleGreen,IIf(below3,colorLightOrange,colorWhite));

TimeFrameSet(inHourly);
EMA8h = Prec(EMA(C,8),2);
MA21h = Prec(MA(C,21),2);
Habove = C>MA21h AND C>EMA8h;
Hbelow = C<MA21h AND C<EMA8h;
TimeFrameRestore();
hourly1 = TimeFrameExpand(Habove,inHourly);
Hourly2 = TimeFrameExpand(Hbelow,inHourly);
text60 = WriteIf(Hourly1,"above",WriteIf(Hourly2,"below",""));
Color60 = IIf(Hourly1,colorPaleGreen,IIf(Hourly2,colorLightOrange,colorWhite));

TimeFrameSet(in15Minute);
EMA15 = Prec(EMA(C,8),2);
MA15 = Prec(MA(C,21),2);
above15 = C>MA15 AND C>EMA15;
below15 = C<MA15 AND C<EMA15;
TimeFrameRestore();
above15e =  TimeFrameExpand(above15,in15Minute);
below15e = TimeFrameExpand(below15,in15Minute);
text15 = WriteIf(above15e,"above",WriteIf(below15e,"below",""));
Color15 = IIf(above15e,colorGreen,IIf(below15e,colorRed,colorWhite));

TimeFrameSet(inDaily);
TimeFrameRestore();
aboveDe =  TimeFrameExpand(aboved,inDaily);
belowDe = TimeFrameExpand(belowd,inDaily);
textd = WriteIf(abovede,"above",WriteIf(belowde,"below",""));
Colord = IIf(abovede,colorGreen,IIf(belowde,colorRed,colorWhite));

_SECTION_END();

//////exploration/////////////////////////////////////////////////////////////
Colorc = IIf(Ref(L,-1)>Ref(L,-2),colorGreen,IIf(Ref(H,-1)<Ref(H,-2),colorOrange,colorDefault));
//prevvwap = WriteIf(vwap>prevdayvaluehigh,"above",WriteIf(Refvwap<prevdayvaluelow,"below","inside"));
Filter = Status("lastbarinrange");
SetOption("NoDefaultColumns", True);
AddColumn(DateTime(), "Date", formatDateTime,colorDefault,color3,120) ;//, Color, BG, 100);

sample

Last edited:

#### vijkris

##### Learner and Follower
SIX TYPES OF RISK TO MANAGE IN TRADING

The calculated risk you take on each individual trade is adjusted by changing your trade size. This is the only risk you can control. A good rule of thumb is to never risk more than 2 percent of the capital in your trading account on any one trade.

Market risk
.The inherent risk of being in the market is called market risk and we have absolutely no control over this type of risk.
Market risk may cause our carefully calculated trade risk to be much larger than anticipated.
Market risk can be far greater than trade risk.
For this reason it is best that you never trade with more than 10 percent of your net worth.
This type of risk encompasses catastrophic world events and market crashes that create complete paralysis in the markets.
Events causing market gaps in price against your trade are also considered to be market risk.

Margin risk.
This involves risk where you can lose more than the amount in your margined trading account. Because you are leveraged, you then owe the brokerage ﬁrm money if the trade goes against you.

Liquidity risk
If there are no buyers when you want to sell, you will experience the inconvenience of liquidity risk.
In addition to the inconvenience, this type of risk can b ecostly when the price is going straight down to zero and you are not able to get out.
Liquidity risk can be caused by or aggravated by a market risk event.

Overnight risk.
For swing/positional traders, overnight risk presents a concern in that what can happen overnight, when the markets are closed, can dramatically impact the value of their position. There is the potential to have a gap open at the opening bell where the price is miles away from where it closed the day before.
This gap possibility can negatively impact your account value.

Volatility risk.
A bumpy market may tend to stop you out of trades repeatedly, creating signiﬁcant drawdown. Volatility risk occurs when your stop-loss exits are not in alignment with the market and are not able to breathe with current price ﬂuctuations.

#### vijkris

##### Learner and Follower
BASIC TYPE OF STOP-LOSS EXITS

1. Initial stop.
This stop is identiﬁed before you enter the market.
The initial stop is also used to calculate your position size.
It is the largest loss you will take in the current trade

2. Trailing stop.
Develops as the market develops. This stop enables you to lock in proﬁt as the market moves in your favor.
We exit the market when the market goes against us and our stop is hit.

3. Trend line stop.
Use a trend line placed under the lows in an uptrend or on top of the highs in a downtrend. You want to get out when prices close on the opposite side of the trend line

MOVING STOPS
Never move your stop for emotional reasons, especially when it is your initial stop .
As new trailing stops are determined, you can move your stops to lock in proﬁt.

#### vijkris

##### Learner and Follower

For daytraders, there is risk when holding trades overnight ,since there is always a possibility of unforeseen events occurring after hours. Unexpected events can create a gap open, which may adversely aﬀect your account value.
For example, if you were trading a 15-minutetimeframe,your stoploss and position size would be based on the 15-minute time frame.
But, let’s say you are ﬁve minutes from the close of the day and the trade is proﬁtable and much more proﬁt is possible if you hold the trade overnight based on your 15-minute chart.
When this happens, consider ﬁve rules:

1. The trade must currently be proﬁtable.
2. The 15-minute chart must indicate a solid trend in place.
3. You must set a new stop-loss exit based on the daily chart.
4. Reduce your trade size so that risk remains no more than 2 percent of your trading account based on the new adjusted stop from the daily chart.

5. Be sure to monitor the trade at the opening bell when the market opens the next day.

In this way you will take into account the inherent risks of holding the trade overnight. This will not eliminate your risk, but it will reduce it.

#### vijkris

##### Learner and Follower
TWO PERCENT RISK FORMULA

As a starting point, It is recommended that you do not risk more than 2 percent on any one individual trade.

If you are a more advanced trader and choose to risk more than 2 percent, you will want to substitute the 2 percent amount in this formula with the percent you decide to have at risk prior to doing this calculation.

conservatively I have modified it to 1%.

Formula: Account size×1%=Risk amount
Example:
capital = rs 20,000
rs20,000×1%= 200
Remember,the risk amount of rs200 includes commission and slippage.
You will need to take that into account.

In the example, we can risk rs 200 per trade on a rs20,000 trading account.
The formula for determining proper trade size for this risk amount is as follows:

Formula: [Risk amount−Commission] ÷initial stop loss = trade size

Eg. ABC - ltp @ entry = rs 200 , initial stop = 198; i.e 2 rs , approx brok = 50
therefore [200−50] = 150 is the max loss amt if trade goes wrong.

No.of shares = 150 ÷ 2(initial stop) = 75 shares

we must also include the max loss per day. after crossing that we have to compulsorily stop trading for the day/
As an example, it can be set conservatively as 4% of capital.
that means after hitting 4 consecutive 1% loss, we have to stop trading for the day, and analyse what went wrong.

2 or 3 consecutive days of being stopped out means, for that week trading must be stopped.

Last edited:

##### In persuit of financial independence.
TWO PERCENT RISK FORMULA

As a starting point, It is recommended that you do not risk more than 2 percent on any one individual trade.

If you are a more advanced trader and choose to risk more than 2 percent, you will want to substitute the 2 percent amount in this formula with the percent you decide to have at risk prior to doing this calculation.

conservatively I have modified it to 1%.

Formula: Account size×1%=Risk amount
Example:
capital = rs 20,000
rs20,000×1%= 200
Remember,the risk amount of rs200 includes commission and slippage.
You will need to take that into account.

In the example, we can risk rs 200 per trade on a rs20,000 trading account.
The formula for determining proper trade size for this risk amount is as follows:

Formula: [Risk amount−Commission] ÷initial stop loss = trade size

Eg. ABC - ltp @ entry = rs 200 , initial stop = 198; i.e 2 rs , approx brok = 50
therefore [200−50] = 150 is the max loss amt if trade goes wrong.

No.of shares = 150 ÷ 2(initial stop) = 75 shares

we must also include the max loss per day. after crossing that we have to compulsorily stop trading for the day/
As an example, it can be set conservatively as 4% of capital.
that means after hitting 4 consecutive 1% loss, we have to stop trading for the day, and analyse what went wrong.

2 or 3 consecutive days of being stopped out means, for that week trading must be stopped.
Thanks Vijay, so let's put it as
4% as hard stop for the day
8% for the week
?12% for the month
(Please clarify for week and month)
Regards

#### vijkris

##### Learner and Follower
Thanks Vijay, so let's put it as
4% as hard stop for the day
8% for the week
?12% for the month
(Please clarify for week and month)
Regards
it is purely based on ur risk tolerance, i.e eg. in 2 days u hit max stop for the week i.e 8% loss. it is worst case scenario
Instead of going for vacation, u would have paper traded the remaining week and analysed and found out whether the method worked for u or not.
If paper trade also showed loss means , that means something is seriously wrong with ur plan/strategy/psychology
u wont enter with real money next week Until u make a profits on paper trading or learn the basics once again.

If u can tolerate the high risk( not recommended), u can repeat the same strategy for next week. if again 8% loss means (total = 16%)
then stop trading for whole month and don't return with real money until u have improved.

the above are my personal risk mgmt. settings.
I would have followed the same.