//PRC_AlphaTrend | indicator
//07.04.23
//Nicolas @ www.prorealcode.com
//Sharing ProRealTime knowledge
//author: kivancozbilgic
// --- settings
// AP = 14 //Common Period
// coeff = 1 //Multiplier
// --- end of settings
if (MoneyFlowIndex[ap]>=50) then
magic=Low[0]-AverageTrueRange[ap](close)*coeff
endif
if (MoneyFlowIndex[ap]<50) then
magic=High[0]+AverageTrueRange[ap](close)*coeff
endif
if (MoneyFlowIndex[ap]>=50 and magic<magic[1]) then
magic=magic[1]
endif
if (MoneyFlowIndex[ap]<50 and magic>magic[1]) then
magic=magic[1]
endif
if magic>magic[1] then
r=0
g=255
elsif magic<magic[1]then
r=255
g=0
endif
return magic as "AlphaTrend" coloured(r,g,0) style(line,2)
buonasera a tutti
ciao Roberto
per favore, si puo’ avere una strategia con questo indicatore?
Se apre short, stop 1 tick sopra il massimo della candela precedente e profit dopo 3 candele successive compresa quella dell’apertura posizione
Se apre long, stop 1 tick sotto il minimo della candela precedente e profit dopo 3 candele successive compresa quella dell’apertura posizione
Grazie
JSParticipant
Senior
Ciao,
Prova questo…
//PRC_AlphaTrend | Trading system
AP = 14 //Common Period
coeff = 1 //Multiplier
NumberOfBars=2
if (MoneyFlowIndex[ap]>=50) then
magic=Low[0]-AverageTrueRange[ap](close)*coeff
endif
if (MoneyFlowIndex[ap]<50) then
magic=High[0]+AverageTrueRange[ap](close)*coeff
endif
if (MoneyFlowIndex[ap]>=50 and magic<magic[1]) then
magic=magic[1]
endif
if (MoneyFlowIndex[ap]<50 and magic>magic[1]) then
magic=magic[1]
endif
if NOT OnMarket and magic>magic[1] then
Buy 1 contract at Market
Set Stop Price Low
EndIf
If NOT OnMarket and magic<magic[1]then
SellShort 1 contract at Market
Set Stop Price High
endif
If OnMarket and BarIndex-TradeIndex(1)>NumberOfBars then
Sell at Market
ExitShort at Market
EndIf
mi sono permesso di fare una piccola modifica, altrimenti continua ad aprire posizioni. e ho messo lo stop una candela prima,altrimenti spesso chiude nella stessa candela
//PRC_AlphaTrend | Trading system
DEFPARAM CumulateOrders = false
AP = 14 //Common Period
coeff = 1 //Multiplier
NumberOfBars=5
if (MoneyFlowIndex[ap]>=50) then
magic=Low[0]-AverageTrueRange[ap](close)*coeff
endif
if (MoneyFlowIndex[ap]<50) then
magic=High[0]+AverageTrueRange[ap](close)*coeff
endif
if (MoneyFlowIndex[ap]>=50 and magic<magic[1]) then
magic=magic[1]
endif
if (MoneyFlowIndex[ap]<50 and magic>magic[1]) then
magic=magic[1]
endif
if magic>magic[1] then
Flag=1
elsif magic<magic[1]then
flag=0
endif
if NOT OnMarket and magic>magic[1] and flag<>flag[1] then
Buy 1 contract at Market
Set Stop Price Low[1]
EndIf
If NOT OnMarket and magic<magic[1]and flag<>flag[1] then
SellShort 1 contract at Market
Set Stop Price High[1]
endif
If OnMarket and BarIndex-TradeIndex(1)>NumberOfBars then
Sell at Market
ExitShort at Market
EndIf
Quando si mette uno STOP su un minimo o massimo della candela precedente, è bene assicurarsi che il minimo sia inferiore a quello attuale o che il massimo sia superiore a quello attuale.
Ti consiglio di sostituire le righe 31 e 36 con queste:
Set Stop Price lowest[2](Low)
Set Stop Price highest[2](High)
in questo modo mette lo stop sul minimo più basso o sul massimo più alto delle ultime due candele (quella attuale e quella precedente).