I will explain you in the weekend but in French because I am bad in English
No French in the English speaking forum please. It’s a forum rule! 🙂
Good morning all. For those who have unpleasant remonstrances you keep them for you. I share my work to help you and a piece of code can serve you. To start I calculated the maximum return with a variable for the long and a variable for the short Line 21
PP=positionperf(0)*100 if pp>ppf then ppf=pp endif
After I left the maximum yield for the long and I reduced the value to increase the gain
if longonmarket and ppF>3.6 and pp>ppF-pp then
sell at market
endif
if shortonmarket AND ppF>1.9 and pp>ppF-pp then
exitshort at market
endif
afterwards, I seek to reduce the losses and to maximize the gains while increasing the gains, the ratio loss gains and the% of winning position. It’s the longest and the most complicated. And I realized that line 45
CondBuy2 = (pente > trigger) AND (pente < 0)
Ask me a problem so I looked for a filter to limit the long position openings
// ajout d'un filtre pour achat
MA=Average[4](close)
CondBuy2 = (pente > trigger) AND (pente < 0) and high>MA and coeff>0.9
And I continued and not finished reducing losses and maximizing gains.
If you have ideas I am a taker to avoid writing hundreds of lines.
Next coming I will pass it in MTF In M 5 the code you know In M1 the verification of operations if they are well past.
Because often backtest no problem but in reality it’s something else. Because all operations must pass. I’m waiting for your comment.
Sorry it’s the translator
AEParticipant
Senior
Hi fifi743,
thanks again for your idea.
did you check your strategy in Demo or Live? Have you got the same results than in backtesting?
PaulParticipant
Master
Hi fifi743
You use a lot of market orders, which are influenced by slipppage & spread on every trade.
Isn’t it more reliable (and perhaps not better) to define your price yourself, i.e. the close when you have a signal and then enter on limit else on stop or visa versa on the next bar?
All is depended on the positionperformance, based the price you get from the broker. It should be based on the price you set yourself to work with regardless of slippage.
Maybe it doesn’t matter, maybe a lot I don’t know. What do you think?
Here’s a snippet I use.
If orderhandling=2 then you have to set your own orderprice after a signal, and replace all tradeprice(1) to orderprice (only in your code the trailingstop)
if orderhandling=1 then
pperf=(positionperf(0)*100)
orderprice=tradeprice(1)
//graphonprice orderprice
elsif orderhandling=2 then
if longonmarket then
pperf=((close/orderprice)-1)*100
elsif shortonmarket then
pperf=((orderprice/close)-1)*100
endif
//graphonprice orderprice
elsif orderhandling=3 then //manual
orderprice=12370.7
if longonmarket then
pperf=((close/orderprice)-1)*100
elsif shortonmarket then
pperf=((orderprice/close)-1)*100
endif
//graphonprice orderprice
endif
thank you paul i will test
PaulParticipant
Master
I did implement it, hopefully correctly
the code is still very good!
PaulParticipant
Master
In test1, because condsell/condbuy, it creates signals on multiple bars after each other and then it changes the orderprice too.
to make it stick I used below and other way around.
if not onmarket or shortonmarket[1] then
orderprice=close
endif
The code works too if limit orders are used. This creates now near similar results to the original code. So far it looks reliable.
good-morning Paul ,
yes condbuy / condsell produces several signal at a time.
I search for a filter to limit the conditions.
Hi guys,
Thanks for your amazing work.
I have made some 200k tests in the different versions I found more interesting. From 24/11/2016 to 08/10/2019 (today)
I don´t know why, but I don´t get the same results as you do on the last 2 versions (fifi & fifi´s Paul edit), could you maybe help me understand why?
From left to right: v4.2p / v5.0p / fifi´s / fifi´s Paul edit
PaulParticipant
Master
@capgros
hi, basically it are different strategies now. From my upload I would focus on 5.0p and on fifi43 latest upload. (you picked the first one)
test1 was not correctly coded, 4.2p is too old.
If you want to compare then use the same positionsize /posmax.
PaulParticipant
Master
a comparison 200k bars limit vs market, 1 position
Yesterday/today results were different because of 0.8 entry points. Strangly limit had a better entry but was closed quickly.
Included the correction on previous upload.
Hello,
here is the comparison between my last version and paul’s.
less DD more gains.
in my last version I included supports and resistances weekly and daily.
I still have to include the round numbers
example 11500
there can be a rebound
Hola,
aquí está la comparación entre mi última versión y la de Paul.
menos DD más ganancias.
en mi última versión incluí soportes y resistencias semanales y diarias.
Todavía tengo que incluir el
ejemplo de números redondos 11500
, puede haber un rebote
Thank you very much for your work! The v2 you have hung is not the same as the .mod, right? the * .mod version gives me different results to the latest version v2. We wait with intraga the code. Thanks again for your work and Paul’s