ProRealCode - Trading & Coding with ProRealTime™
voici le second avec c3
// Définition des paramètres du code
DEFPARAM CumulateOrders = false // pas de cumul de positions
DEFPARAM Preloadbars = 1000000
capital= 50000
// Empêche le système de placer des ordres pour entrer sur le marché ou augmenter la taille d'une position avant l'heure spécifiée
noEntryBeforeTime = 150000
timeEnterBefore = time >= noEntryBeforeTime
// Empêche le système de placer des ordres pour entrer sur le marché ou augmenter la taille d'une position après l'heure spécifiée
noEntryAfterTime = 223000
timeEnterAfter = time < noEntryAfterTime
// Empêche le système de placer de nouveaux ordres sur les jours de la semaine spécifiés
daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0
// Conditions pour ouvrir une position acheteuse
indicator1 = SenkouSpanA[9,26,52]
c1 = (close CROSSES OVER indicator1)
indicator2 = SenkouSpanB[9,26,52]
c2 = (close CROSSES OVER indicator2)
c3 = (close > DOpen(0)[1])
IF (c1 AND c2 and c3) AND timeEnterBefore AND timeEnterAfter AND not daysForbiddenEntry THEN
BUY 2 CONTRACT AT MARKET
partial=0
ENDIF
// sortie partielle
if longonmarket and positionperf>1.7/100 and partial=0 then
sell countofposition/9.7 contract at market
partial = 1
endif
if summation[1800](longonmarket)=1800 then
sell at market
endif
if summation[1000](shortonmarket)=1000 then
exitshort at market
endif
// Stops et objectifs
set stop %loss 1.8
set target %profit 1.73
IF Not OnMarket THEN
//
// when NOT OnMarket reset values to default values
//
TrailStart = 65 //30 Start trailing profits from this point
BasePerCent = 0.000 //20.0% Profit percentage to keep when setting BerakEven
StepSize = 1 //10 Pip chunks to increase Percentage
PerCentInc = 0.000 //10.0% PerCent increment after each StepSize chunk
BarNumber = 10 //10 Add further % so that trades don't keep running too long
BarPerCent = 0.235 //10% Add this additional percentage every BarNumber bars
RoundTO = -0.5 //-0.5 rounds always to Lower integer, +0.4 rounds always to Higher integer, 0 defaults PRT behaviour
PriceDistance = 9 * pipsize //7 minimun distance from current price
y1 = 0 //reset to 0
y2 = 0 //reset to 0
ProfitPerCent = BasePerCent //reset to desired default value
TradeBar = BarIndex
ELSIF LongOnMarket AND close > (TradePrice + (y1 * pipsize)) THEN //LONG positions
//
// compute the value of the Percentage of profits, if any, to lock in for LONG trades
//
x1 = (close - tradeprice) / pipsize //convert price to pips
IF x1 >= TrailStart THEN // go ahead only if N+ pips
Diff1 = abs(TrailStart - x1) //difference from current profit and TrailStart
Chunks1 = max(0,round((Diff1 / StepSize) + RoundTO)) //number of STEPSIZE chunks
ProfitPerCent = BasePerCent + (BasePerCent * (Chunks1 * PerCentInc)) //compute new size of ProfitPerCent
// compute number of bars elapsed and add an additionl percentage
// (this percentage is different from PerCentInc, since it's a direct percentage, not a Percentage of BasePerCent)
// (if BasePerCent is 20% and this is 10%, the whole percentage will be 30%, not 22%)
BarCount = BarIndex - TradeBar
IF BarCount MOD BarNumber = 0 THEN
ProfitPerCent = ProfitPerCent + BarPerCent
ENDIF
//
ProfitPerCent = max(ProfitPerCent[1],min(100,ProfitPerCent)) //make sure ProfitPerCent doess not exceed 100%
y1 = max(x1 * ProfitPerCent, y1) //y1 = % of max profit
ENDIF
ELSIF ShortOnMarket AND close < (TradePrice - (y2 * pipsize)) THEN //SHORT positions
//
// compute the value of the Percentage of profits, if any, to lock in for SHORT trades
//
x2 = (tradeprice - close) / pipsize //convert price to pips
IF x2 >= TrailStart THEN // go ahead only if N+ pips
Diff2 = abs(TrailStart - x2) //difference from current profit and TrailStart
Chunks2 = max(0,round((Diff2 / StepSize) + RoundTO)) //number of STEPSIZE chunks
ProfitPerCent = BasePerCent + (BasePerCent * (Chunks2 * PerCentInc)) //compute new size of ProfitPerCent
// compute number of bars elapsed and add an additionl percentage
// (this percentage is different from PerCentInc, since it's a direct percentage, not a Percentage of BasePerCent)
// (if BasePerCent is 20% and this is 10%, the whole percentage will be 30%, not 22%)
BarCount = BarIndex - TradeBar
IF BarCount MOD BarNumber = 0 THEN
ProfitPerCent = ProfitPerCent + BarPerCent
ENDIF
//
ProfitPerCent = max(ProfitPerCent[1],min(100,ProfitPerCent)) //make sure ProfitPerCent doess not exceed 100%
y2 = max(x2 * ProfitPerCent, y2) //y2 = % of max profit
ENDIF
ENDIF
IF y1 THEN //Place pending STOP order when y1 > 0 (LONG positions)
SellPrice = Tradeprice + (y1 * pipsize) //convert pips to price
//
// check the minimun distance between ExitPrice and current price
//
IF abs(close - SellPrice) > PriceDistance THEN
//
// place either a LIMIT or STOP pending order according to current price positioning
//
IF close >= SellPrice THEN
SELL AT SellPrice STOP
ELSE
SELL AT SellPrice LIMIT
ENDIF
ELSE
//
//sell AT MARKET when EXITPRICE does not meet the broker's minimun distance from current price
//
SELL AT Market
ENDIF
ENDIF
IF y2 THEN //Place pending STOP order when y2 > 0 (SHORT positions)
ExitPrice = Tradeprice - (y2 * pipsize) //convert pips to price
//
// check the minimun distance between ExitPrice and current price
//
IF abs(close - ExitPrice) > PriceDistance THEN
//
// place either a LIMIT or STOP pending order according to current price positioning
//
IF close <= ExitPrice THEN
EXITSHORT AT ExitPrice STOP
ELSE
EXITSHORT AT ExitPrice LIMIT
ENDIF
ELSE
//
//ExitShort AT MARKET when EXITPRICE does not meet the broker's minimun distance from current price
//
EXITSHORT AT Market
ENDIF
et fifi743 voici un autre avec d’autres paramètre modifié notamment trailstar , le take profit
// Définition des paramètres du code
DEFPARAM CumulateOrders = false // pas de cumul de positions
DEFPARAM Preloadbars = 200000
capital= 50000
// Empêche le système de placer des ordres pour entrer sur le marché ou augmenter la taille d'une position avant l'heure spécifiée
noEntryBeforeTime = 150000
timeEnterBefore = time >= noEntryBeforeTime
// Empêche le système de placer des ordres pour entrer sur le marché ou augmenter la taille d'une position après l'heure spécifiée
noEntryAfterTime = 223000
timeEnterAfter = time < noEntryAfterTime
// Empêche le système de placer de nouveaux ordres sur les jours de la semaine spécifiés
daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0
// Conditions pour ouvrir une position acheteuse
indicator1 = SenkouSpanA[9,26,52]
c1 = (close CROSSES OVER indicator1)
indicator2 = SenkouSpanB[9,26,52]
c2 = (close CROSSES OVER indicator2)
c3 = (close > DOpen(0)[1])
IF (c1 AND c2 )AND timeEnterBefore AND timeEnterAfter AND not daysForbiddenEntry and tally < maxTrades THEN
BUY 2 CONTRACT AT MARKET
partiel=0
ENDIF
// sortie partielle
if longonmarket and positionperf>0.42/100 and partial=0 then
sell countofposition/9.1 contract at market
partial = 1
endif
//---------------------------------------------------------------------------------------------------------------
once maxTrades = 5 //maxNumberDailyTrades
once tally = 0
if intradayBarIndex = 0 then
tally = 0
endif
newTrades = (onMarket and not onMarket[1]) or ((not onMarket and not onMarket[1]) and (strategyProfit <> strategyProfit[1])) or (longOnMarket and ShortOnMarket[1]) or (longOnMarket[1] and shortOnMarket) or ((tradeIndex(1) = tradeIndex(2)) and (barIndex = tradeIndex(1)) and (barIndex > 0) and (strategyProfit = strategyProfit[1]))
if newTrades then
tally = tally +1
endif
//--------------------------------------------------------------
//---------------------------------------------------------------------------------------------------------------
//Max-Orders per Day
once maxOrdersL = 1 //long
once maxOrdersS = 1 //short
if intradayBarIndex = 0 then //reset orders count
ordersCountL = 0
ordersCountS = 0
endif
if longTriggered then //check if an order has opened in the current bar
ordersCountL = ordersCountL + 1
endif
if shortTriggered then //check if an order has opened in the current bar
ordersCountS = ordersCountS + 1
endif
//--------------------------------------------------------------
// Stops et objectifs
set stop %loss 1.40
set target %profit 0.668
IF Not OnMarket THEN
//
// when NOT OnMarket reset values to default values
//
TrailStart = 5.2 //30 Start trailing profits from this point
BasePerCent = 0.000 //20.0% Profit percentage to keep when setting BerakEven
StepSize = 1 //10 Pip chunks to increase Percentage
PerCentInc = 0.000 //10.0% PerCent increment after each StepSize chunk
BarNumber = 1 //10 Add further % so that trades don't keep running too long
BarPerCent = 0.235 //10% Add this additional percentage every BarNumber bars
RoundTO = -0.5 //-0.5 rounds always to Lower integer, +0.4 rounds always to Higher integer, 0 defaults PRT behaviour
PriceDistance = 9 * pipsize //7 minimun distance from current price
y1 = 0 //reset to 0
y2 = 0 //reset to 0
ProfitPerCent = BasePerCent //reset to desired default value
TradeBar = BarIndex
ELSIF LongOnMarket AND close > (TradePrice + (y1 * pipsize)) THEN //LONG positions
//
// compute the value of the Percentage of profits, if any, to lock in for LONG trades
//
x1 = (close - tradeprice) / pipsize //convert price to pips
IF x1 >= TrailStart THEN // go ahead only if N+ pips
Diff1 = abs(TrailStart - x1) //difference from current profit and TrailStart
Chunks1 = max(0,round((Diff1 / StepSize) + RoundTO)) //number of STEPSIZE chunks
ProfitPerCent = BasePerCent + (BasePerCent * (Chunks1 * PerCentInc)) //compute new size of ProfitPerCent
// compute number of bars elapsed and add an additionl percentage
// (this percentage is different from PerCentInc, since it's a direct percentage, not a Percentage of BasePerCent)
// (if BasePerCent is 20% and this is 10%, the whole percentage will be 30%, not 22%)
BarCount = BarIndex - TradeBar
IF BarCount MOD BarNumber = 0 THEN
ProfitPerCent = ProfitPerCent + BarPerCent
ENDIF
//
ProfitPerCent = max(ProfitPerCent[1],min(100,ProfitPerCent)) //make sure ProfitPerCent doess not exceed 100%
y1 = max(x1 * ProfitPerCent, y1) //y1 = % of max profit
ENDIF
ELSIF ShortOnMarket AND close < (TradePrice - (y2 * pipsize)) THEN //SHORT positions
//
// compute the value of the Percentage of profits, if any, to lock in for SHORT trades
//
x2 = (tradeprice - close) / pipsize //convert price to pips
IF x2 >= TrailStart THEN // go ahead only if N+ pips
Diff2 = abs(TrailStart - x2) //difference from current profit and TrailStart
Chunks2 = max(0,round((Diff2 / StepSize) + RoundTO)) //number of STEPSIZE chunks
ProfitPerCent = BasePerCent + (BasePerCent * (Chunks2 * PerCentInc)) //compute new size of ProfitPerCent
// compute number of bars elapsed and add an additionl percentage
// (this percentage is different from PerCentInc, since it's a direct percentage, not a Percentage of BasePerCent)
// (if BasePerCent is 20% and this is 10%, the whole percentage will be 30%, not 22%)
BarCount = BarIndex - TradeBar
IF BarCount MOD BarNumber = 0 THEN
ProfitPerCent = ProfitPerCent + BarPerCent
ENDIF
//
ProfitPerCent = max(ProfitPerCent[1],min(100,ProfitPerCent)) //make sure ProfitPerCent doess not exceed 100%
y2 = max(x2 * ProfitPerCent, y2) //y2 = % of max profit
ENDIF
ENDIF
IF y1 THEN //Place pending STOP order when y1 > 0 (LONG positions)
SellPrice = Tradeprice + (y1 * pipsize) //convert pips to price
//
// check the minimun distance between ExitPrice and current price
//
IF abs(close - SellPrice) > PriceDistance THEN
//
// place either a LIMIT or STOP pending order according to current price positioning
//
IF close >= SellPrice THEN
SELL AT SellPrice STOP
ELSE
SELL AT SellPrice LIMIT
ENDIF
ELSE
//
//sell AT MARKET when EXITPRICE does not meet the broker's minimun distance from current price
//
SELL AT Market
ENDIF
ENDIF
IF y2 THEN //Place pending STOP order when y2 > 0 (SHORT positions)
ExitPrice = Tradeprice - (y2 * pipsize) //convert pips to price
//
// check the minimun distance between ExitPrice and current price
//
IF abs(close - ExitPrice) > PriceDistance THEN
//
// place either a LIMIT or STOP pending order according to current price positioning
//
IF close <= ExitPrice THEN
EXITSHORT AT ExitPrice STOP
ELSE
EXITSHORT AT ExitPrice LIMIT
ENDIF
ELSE
//
//ExitShort AT MARKET when EXITPRICE does not meet the broker's minimun distance from current price
//
EXITSHORT AT Market
ENDIF
ENDIF
au passage si tu peux partager les tiens et autres avec des performances sur unité de temps plus courtes aussi. Mais celui en 15 et 30 minutes tu peux partager?
les algos sont avec le spread a 1 je précise
Pour eur/usd pour info j’ai réglé take profit à 0.20 et trailstart à 3.0 apres si tu augmentes des pertes apparaissent. exemple 0.22
bonjour nasdaq en 5 mnutes posté
eur/usd time 3 .
avec modification de fiffi743.
// Définition des paramètres du code
DEFPARAM CumulateOrders = False
DEFPARAM PRELOADBARS = 2000
// Empêche le système de placer des ordres pour entrer sur le marché ou augmenter la taille d'une position avant l'heure spécifiée
noEntryBeforeTime = 090000
timeEnterBefore = time >= noEntryBeforeTime
// Empêche le système de placer des ordres pour entrer sur le marché ou augmenter la taille d'une position après l'heure spécifiée
noEntryAfterTime = 110000
timeEnterAfter = time < noEntryAfterTime
// Empêche le système de placer de nouveaux ordres sur les jours de la semaine spécifiés
daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0
// Conditions pour ouvrir une position en vente à découvert
// Conditions pour ouvrir une position en vente à découvert
indicator1 = SenkouSpanB[9,26,52]
indicator2 = SenkouSpanA[9,26,52]
c1 = (close CROSSES UNDER indicator1)
c2 = (close CROSSES UNDER indicator2)
indicator3 = Average[400](close)
c3 = (close > indicator3)
IF (c1 AND c2 and (c3 or (high[3]<high[1]and low[3]<low[1] )))AND timeEnterBefore AND timeEnterAfter AND not daysForbiddenEntry and tally < maxTrades THEN
sellshort 1 CONTRACT AT MArket
partial=0
endif
// sortie partielle
if shortonmarket and positionperf>0.10/100 and partial=0 then
exitshort 0.05 contract at market
partial = 1
endif
once maxTrades = 10 //maxNumberDailyTrades
once tally = 0
if intradayBarIndex = 0 then
tally = 0
endif
newTrades = (onMarket and not onMarket[1]) or ((not onMarket and not onMarket[1]) and (strategyProfit <> strategyProfit[1])) or (longOnMarket and ShortOnMarket[1]) or (longOnMarket[1] and shortOnMarket) or ((tradeIndex(1) = tradeIndex(2)) and (barIndex = tradeIndex(1)) and (barIndex > 0) and (strategyProfit = strategyProfit[1]))
if newTrades then
tally = tally +1
endif
//------------------------------------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------------------------
//Max-Orders per Day
once maxOrdersL = 1 //long
once maxOrdersS = 1 //short
if intradayBarIndex = 0 then //reset orders count
ordersCountL = 0
ordersCountS = 0
endif
if longTriggered then //check if an order has opened in the current bar
ordersCountL = ordersCountL + 1
endif
if shortTriggered then //check if an order has opened in the current bar
ordersCountS = ordersCountS + 1
endif
//------------------------------------------------------------------------------------------------------------------------
// Stops et objectifs
set stop %loss 0.58
set target %profit 0.20
IF Not OnMarket THEN
//
// when NOT OnMarket reset values to default values
//
TrailStart = 3.0 //30 Start trailing profits from this 1.74
BasePerCent = 0.000 //20.0% Profit percentage to keep when setting BerakEven
StepSize = 1 //10 Pip chunks to increase Percentage
PerCentInc = 0.000 //10.0% PerCent increment after each StepSize chunk
BarNumber = 10 //10 Add further % so that trades don't keep running too long
BarPerCent = 0.235 //10% Add this additional percentage every BarNumber bars
RoundTO = -0.5 //-0.5 rounds always to Lower integer, +0.4 rounds always to Higher integer, 0 defaults PRT behaviour
PriceDistance = 9 * pipsize //7 minimun distance from current price
y1 = 0 //reset to 0
y2 = 0 //reset to 0
ProfitPerCent = BasePerCent //reset to desired default value
TradeBar = BarIndex
ELSIF LongOnMarket AND close > (TradePrice + (y1 * pipsize)) THEN //LONG positions
//
// compute the value of the Percentage of profits, if any, to lock in for LONG trades
//
x1 = (close - tradeprice) / pipsize //convert price to pips
IF x1 >= TrailStart THEN // go ahead only if N+ pips
Diff1 = abs(TrailStart - x1) //difference from current profit and TrailStart
Chunks1 = max(0,round((Diff1 / StepSize) + RoundTO)) //number of STEPSIZE chunks
ProfitPerCent = BasePerCent + (BasePerCent * (Chunks1 * PerCentInc)) //compute new size of ProfitPerCent
// compute number of bars elapsed and add an additionl percentage
// (this percentage is different from PerCentInc, since it's a direct percentage, not a Percentage of BasePerCent)
// (if BasePerCent is 20% and this is 10%, the whole percentage will be 30%, not 22%)
BarCount = BarIndex - TradeBar
IF BarCount MOD BarNumber = 0 THEN
ProfitPerCent = ProfitPerCent + BarPerCent
ENDIF
//
ProfitPerCent = max(ProfitPerCent[1],min(100,ProfitPerCent)) //make sure ProfitPerCent doess not exceed 100%
y1 = max(x1 * ProfitPerCent, y1) //y1 = % of max profit
ENDIF
ELSIF ShortOnMarket AND close < (TradePrice - (y2 * pipsize)) THEN //SHORT positions
//
// compute the value of the Percentage of profits, if any, to lock in for SHORT trades
//
x2 = (tradeprice - close) / pipsize //convert price to pips
IF x2 >= TrailStart THEN // go ahead only if N+ pips
Diff2 = abs(TrailStart - x2) //difference from current profit and TrailStart
Chunks2 = max(0,round((Diff2 / StepSize) + RoundTO)) //number of STEPSIZE chunks
ProfitPerCent = BasePerCent + (BasePerCent * (Chunks2 * PerCentInc)) //compute new size of ProfitPerCent
// compute number of bars elapsed and add an additionl percentage
// (this percentage is different from PerCentInc, since it's a direct percentage, not a Percentage of BasePerCent)
// (if BasePerCent is 20% and this is 10%, the whole percentage will be 30%, not 22%)
BarCount = BarIndex - TradeBar
IF BarCount MOD BarNumber = 0 THEN
ProfitPerCent = ProfitPerCent + BarPerCent
ENDIF
//
ProfitPerCent = max(ProfitPerCent[1],min(100,ProfitPerCent)) //make sure ProfitPerCent doess not exceed 100%
y2 = max(x2 * ProfitPerCent, y2) //y2 = % of max profit
ENDIF
ENDIF
IF y1 THEN //Place pending STOP order when y1 > 0 (LONG positions)
SellPrice = Tradeprice + (y1 * pipsize) //convert pips to price
//
// check the minimun distance between ExitPrice and current price
//
IF abs(close - SellPrice) > PriceDistance THEN
//
// place either a LIMIT or STOP pending order according to current price positioning
//
IF close >= SellPrice THEN
SELL AT SellPrice STOP
ELSE
SELL AT SellPrice LIMIT
ENDIF
ELSE
//
//sell AT MARKET when EXITPRICE does not meet the broker's minimun distance from current price
//
SELL AT Market
ENDIF
ENDIF
IF y2 THEN //Place pending STOP order when y2 > 0 (SHORT positions)
ExitPrice = Tradeprice - (y2 * pipsize) //convert pips to price
//
// check the minimun distance between ExitPrice and current price
//
IF abs(close - ExitPrice) > PriceDistance THEN
//
// place either a LIMIT or STOP pending order according to current price positioning
//
IF close <= ExitPrice THEN
EXITSHORT AT ExitPrice STOP
ELSE
EXITSHORT AT ExitPrice LIMIT
ENDIF
ELSE
//
//ExitShort AT MARKET when EXITPRICE does not meet the broker's minimun distance from current price
//
EXITSHORT AT Market
ENDIF
ENDIF
Qui pourrait le faire dans le sens de l’achat?
Wonderful.
Enclosed the backtest 1Mio units
Enclosed the itf-file with which was tested
tested was the first code which was published, quasi without mods
Ci-joint le fichier itf avec lequel le code a été testé joint le tableau de bord 1 Mio unités
Salut fiffi,
je te dérange 2 minutes , je suis intéressé par tes algo si tu veux bien partager et si tu as fait attention j’ai partagé quelques algo peux tu travailler dessus afin d’améliorer ?
Dans l’attente de te lire.
bonjour,
OK pour l’échange tu me donne ta Ferrari et je te donne ma vielle 2 CV ,elle roule mais elle est sur cale pour l’instant.
Bonjour fifi743 ,
J’ai un algo a tester , voila la stratégie serait quand l’algo eur/usd se met en route je voudrais pouvoir en faire un autre qui puisse démarrer avec les parametres de fibonacci c’est a dire quand leurusd ouvre une position et qu’on prend le dernier plus haut en timeframe 1h ou 4h ou 15 min par exemple et que le cours retrace les 50 ou 60% par rapport a fibonacci , je voudrais qu’il ouvre une position à la vente et que le take profit soit calquer sur celui de l’eurusd et le stop égalment.
Bonjour JohnScher,
je viens vers toi pour une élaborer une technique que je voudrais paramétrer.
Je voudrais en prenant l’algo eur/usd 3 minutes insérer ou faire un autre algo en parallèle à celui la qui utilise fibonacci.
Je voudrais que l’algo démarre quand il retrace par exemple les 50% dans l’unité de temps soit 5ou 15 ou 1h par rapport au trade prix par l’algo eur/usd.
Dans l’attente de te lire
BONJOUR
j’ai remarqué que les pertes se font en tendance haussière … et à l’inverse , les profits se font dans la tendance contraire.
A bon entendeurs salut!
eur/usd position à la vente
This topic contains 51 replies,
has 7 voices, and was last updated by Marlaynicolas
1 year, 2 months ago.
| Forum: | ProOrder : Trading Automatique & Backtests |
| Language: | French |
| Started: | 12/24/2022 |
| Status: | Active |
| Attachments: | 30 files |
The information collected on this form is stored in a computer file by ProRealCode to create and access your ProRealCode profile. This data is kept in a secure database for the duration of the member's membership. They will be kept as long as you use our services and will be automatically deleted after 3 years of inactivity. Your personal data is used to create your private profile on ProRealCode. This data is maintained by SAS ProRealCode, 407 rue Freycinet, 59151 Arleux, France. If you subscribe to our newsletters, your email address is provided to our service provider "MailChimp" located in the United States, with whom we have signed a confidentiality agreement. This company is also compliant with the EU/Swiss Privacy Shield, and the GDPR. For any request for correction or deletion concerning your data, you can directly contact the ProRealCode team by email at privacy@prorealcode.com If you would like to lodge a complaint regarding the use of your personal data, you can contact your data protection supervisory authority.