I recently start with coding and I learned a lot with reading the articles on this forum and the code I found.
Now I’m working on the Trailing Stop code which I found on in this forum. The code is working (backtesting + Paper Trading) but I have a question:
When the trade starts, the ‘ stop’ is not immediately active, but after the entry candle has been closed and the conditions has been met, then the Trailing Stop will be active.
This means that I have a risk because when I enter my trade, there is no stop…….is that correct assumption? Or do I use the Trailing Stop code incorrect?
But when I enter a trade, I want to have immediately a stop to avoid the risk, how do I program that in the code?
Can you help?
Below a code (simple sample code) with the Trailing Stop which is working in Backtesting + Papertrading:
——————————————————————————————————————————
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
Defparamcumulateorders=false
//order launch (example) would be set to any other entry conditions
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.