Hello!
I am a programming beginner and I am stuck with coding the following problem.
After opening a trade (e.g. long entry), I would like to place a stop order (for stop loss) at one of the last pivot points (in this case, e.g. at the last or penultimate pivot low). However, it may be that the pivot points are higher than the entry. That's why you have to go back until a deeper pivot point is found. You can see the case in the screenshot. The stop order can only be placed on the green arrow, not on the red arrow.
can someone help me?
Thank you
Best
Michael
Coding a stop order at the last pivot point for stoploss [SOLVED]
-
- Posts: 5
- Joined: 05 Aug 2021
- Has thanked: 5 times
-
- Posts: 82
- Joined: 10 Feb 2022
- Has thanked: 52 times
- Been thanked: 11 times
Re: Coding a stop order at the last pivot point for stoploss
Unfortunately, I don't know easy language, but if there are lists or arrays in easy language, you could save the pivot points when they occur in an array and then access the previous pivot points accordingly: i.e. Array[0] for the current pivot low point and array [1] for the previous low point. Another approach could be to use series (if that exists). I hope this approach helps you
- ABC
- Posts: 721
- Joined: 16 Dec 2006
- Location: www.abctradinggroup.com
- Has thanked: 125 times
- Been thanked: 409 times
- Contact:
Re: Coding a stop order at the last pivot point for stoploss
Hi Michael,
the pivot function has an instance parameter that allows you to look back at prior pivots. From a programming point of view it is however a better approach to store the pivot points as they occur in an array or list as HellGhostEvocatorX has pointed out and use this to look at the prior values when you issue your trade.
Regards,
ABC
the pivot function has an instance parameter that allows you to look back at prior pivots. From a programming point of view it is however a better approach to store the pivot points as they occur in an array or list as HellGhostEvocatorX has pointed out and use this to look at the prior values when you issue your trade.
Regards,
ABC
-
- Posts: 5
- Joined: 05 Aug 2021
- Has thanked: 5 times
Re: Coding a stop order at the last pivot point for stoploss [SOLVED]
Hello!
Sorry, but as i am a beginner i have problems with the array assignment.
This is my code:
But i receive the error message:
Last_Pivot_Lows(Pivot_count) = PivotLowVS(Pivot_count, Low, 3, 3, 30) ;
Can someone tell me what the problem is?
Thank you
Michael
Sorry, but as i am a beginner i have problems with the array assignment.
This is my code:
Code: Select all
array: Last_Pivot_Lows[100](0);
var: Pivot_count(1);
For Pivot_count = 1 to 100 begin
Last_Pivot_Lows(Pivot_count) = PivotLowVS(Pivot_count, Low, 3, 3, 30) ;
end;
But i receive the error message:
Line 5 is as following:Unknown Function
line 5, column 1
Last_Pivot_Lows(Pivot_count) = PivotLowVS(Pivot_count, Low, 3, 3, 30) ;
Can someone tell me what the problem is?
Thank you
Michael
- ABC
- Posts: 721
- Joined: 16 Dec 2006
- Location: www.abctradinggroup.com
- Has thanked: 125 times
- Been thanked: 409 times
- Contact:
Re: Coding a stop order at the last pivot point for stoploss
Hi Michael,
the index for the array must be in square brackets and not parenthesis when you try to store or access values in the array.
If you haven't done it, yet, check the free EasyLanguage Essentials PDF that you can find with your search engine of choice. Although written for TS, it is an excellent primer for PowerLanuage, too.
Regards,
ABC
the index for the array must be in square brackets and not parenthesis when you try to store or access values in the array.
If you haven't done it, yet, check the free EasyLanguage Essentials PDF that you can find with your search engine of choice. Although written for TS, it is an excellent primer for PowerLanuage, too.
Regards,
ABC
-
- Posts: 5
- Joined: 05 Aug 2021
- Has thanked: 5 times
Re: Coding a stop order at the last pivot point for stoploss
Thank you, that was really a stupid mistake