supertrend" >DEFPARAM CUMULATEORDERS = false
DEFPARAM PRELOADBARS = 200
//bear
bear = supertrend < close [12.28]
bear2 = supertrend < close [3.10]
//////////////////////////////////
//bull
bull = supertrend < close [30.210]
a = High[0] - Low[0]
b = Min(Open[0], Close[0]) - Low[0]
c = b/a
d = c*2
//abcd = condition
// Conditions to enter long positions
//IF NOT LongOnMarket AND a and b and c and d THEN
//BUY 1 CONTRACTS AT MARKET
//ENDIF
// Conditions to exit long positions
//If LongOnMarket AND YourConditions THEN
//SELL AT MARKET
//ENDIF
// Conditions to enter short positions
IF NOT ShortOnMarket AND bear and bear2 and d THEN
SELLSHORT 1 CONTRACTS AT MARKET
ENDIF
// Conditions to exit short positions
IF ShortOnMarket AND bull THEN
EXITSHORT AT MARKET
ENDIF
// Stops and targets : Enter your protection stops and profit targets here
SET STOP PTRAILING 82
SET TARGET PROFIT 182
Is there a question?
My first question would be why are you using decimal places in the CLOSE[x] in your code. You can’t get the info from a decimal part of a bar. ProRealCode will just round it.
Second question: ‘d’ will always be a positive value and so will always be true and so is not doing anything in your code.
I think those brackets are intended for SUPERTREND, but:
- they must be put next to ST
- a comma must be used to separate the two numbers, instead of a period.
Line 1 is a bit messy.
Have you had any chance to read documentation about SuperTrend?
Sorry about line 1, please disregard that mistake, first time uplaoding to the Forum
was also trying to streamline the supertrend as apposed to being
indicator1 = SuperTrend[3,10]
c1 = (close > indicator1)
maybe that’s why the system is not acknowledging it
DEFPARAM CUMULATEORDERS = false
DEFPARAM PRELOADBARS = 200
//bear
bear = supertrend[12,28]
c1 = (close < bear)
bear2 = supertrend[3,10]
c2 = (close < bear2)
//////////////////////////////////
//bull
//bull = supertrend[30,210]
//c3 = (close < bull)
a = High[0] - Low[0]
b = Min(Open[0], Close[0]) - Low[0]
c = b/a
d = c*2
//abcd = condition
// Conditions to enter long positions
//IF NOT LongOnMarket AND a and b and c and d THEN
//BUY 1 CONTRACTS AT MARKET
//ENDIF
// Conditions to exit long positions
//If LongOnMarket AND YourConditions THEN
//SELL AT MARKET
//ENDIF
// Conditions to enter short positions
IF NOT ShortOnMarket AND c1 and c2 and d THEN
SELLSHORT 1 CONTRACTS AT MARKET
ENDIF
// Conditions to exit short positions
//IF ShortOnMarket AND c3 THEN
//EXITSHORT AT MARKET
//ENDIF
// Stops and targets : Enter your protection stops and profit targets here
SET STOP PTRAILING 82
SET TARGET PROFIT 182
Hi,
Tided up some lo0se ends on that with advice taken onboard, thanks.
Also added another condition
bear3 = supertrend[36,211]
c3 = (close < bear3)
seems much better,
Still would like to learn how to streamline the supertrend read code as an indicator/ condition, i will check the PRT manual,
Regards and Thanks
‘d’ is still doing absolutely nothing!
a = High[0] - Low[0]
b = Min(Open[0], Close[0]) - Low[0]
c = b/a
d = c*2
// Conditions to enter short positions
IF NOT ShortOnMarket AND c1 and c2 and d THEN
‘d’ is just going to return (the lower shadow as a percentage of the range) x 2. It will always be a positive value so ‘and d’ will always be true.
yes, just an inert example i throw in,
that i’d seen somewhere in the past,
maybe someone can put life into it,
Try something like:
a = High[0] - Low[0]
b = Min(Open[0], Close[0]) - Low[0]
c = b/a
d = c*100
// Conditions to enter short positions
IF NOT ShortOnMarket AND c1 and c2 and d <= 25 THEN
This sets a condition where the lower shadow must be less than or equal to 25% of the total range.
Thanks,
you nailed it, d was that originally.
i should have never altered it!
Its it possible to explain the function of <= 25
does it relate to less that 25 bars?
No! 25 is the percentage. So the candles lower shadow is 25% or less of the candles total range.