Total Beginner
Forums › ProRealTime English forum › ProOrder support › Total Beginner
- This topic has 38 replies, 6 voices, and was last updated 3 years ago by
GraHal.
-
-
10/03/2022 at 8:28 PM #201870
Hello
I am a mother of 2 with no very much time to sit in front of the computer to watch all day the charts for set ups and I am trying to get into setting up a simple automated system. Can someone show me where I have gone wrong? Most appreciate your kind assistance.
I would also be thankful for some pointers where I can read up / watch the best learning material for programming PRT.
10/03/2022 at 8:48 PM #20187412345678910if average[8]<close[1] thenif open>close[1] thensignal=lowstoploss=lowest[5](low)takeprofit=(close-stoploss)*2elsesignal=0endifendifreturn signal,stoplossthis code is for an indicator
1 user thanked author for this post.
10/03/2022 at 9:59 PM #201875Thanks for the pointer.
I have rewritten the set up and there is an issue with the stop as it doesn’t properly trails the position.
Furthermore the system doesn’t open every time the conditions are met a new position
Do you know if there are any sample codes so that I can see what the approximate set up would need to look like?
10/04/2022 at 3:08 AM #201880Post the code you have written doing Copy and Paste, please.
10/04/2022 at 8:13 AM #201889Good morning.
here the code, my main issues are that the code doesn’t open on each bar a position although the conditions are fulfilled and the stop is just a simple trailing stop and I would like to have it move from low close [1] to the next candle. But not sure how to write this code.
Truly appreciate you taking time to help me out, means the world to me. Thank you!
// Definition of code parameters
DEFPARAM CumulateOrders = False // Cumulating positions deactivated
DEFPARAM FLATBEFORE = 083000
DEFPARAM FLATAFTER = 220000// Conditions to enter long positions
indicator1 = ExponentialAverage[20](close)
c1 = (close >= indicator1[1])IF c1 THEN
BUY 0.5 CONTRACT AT MARKET
ENDIF// Conditions to exit long positions
indicator2 = ExponentialAverage[20](close)
c2 = (close CROSSES UNDER indicator2[1])IF c2 THEN
SELL AT MARKET
ENDIF
SET STOP TRAILING 10// Conditions to enter short positions
indicator1 = ExponentialAverage[20](close)
c1 = (close <= indicator1[1])IF c1 THEN
SELLSHORT 0.5 CONTRACT AT MARKET
ENDIF// Conditions to exit short positions
indicator2 = ExponentialAverage[20](close)
c2 = (close > indicator2)Hope this is ok.
10/04/2022 at 10:15 AM #201894I have moved this topic to ProOrder support, as it deals with strategies. Please use the correct support forum and read carefully the basic rules below (highlighted in yellow). Thank you 🙂
Your code is missing the last lines to exit Short trades:
123IF c2 THENEXITSHORT AT MARKETENDIFas to the trailing stop, it will be updated every 10 pips (oor 10 price units, if not an index).
1 user thanked author for this post.
10/04/2022 at 3:07 PM #201909Hi Roberto
thank you for reviewing my code, I am stuck again and was wondering if you would be so kind to help me out. When I backtest this code it doesn’t give me any trades and I don’t see the trees for the forest anymore.
// Definition of code parameters
DEFPARAM CumulateOrders = False // Cumulating positions deactivated// Conditions to enter long positions
EMA20 = ExponentialAverage[20](close)
EMA50 = ExponentialAverage[50](close)
avg169 = Average[169](close)c1 = EMA20 CROSSES OVER EMA50
c2 = close [0] > close [1]IF c1 AND c2 THEN
BUY 1 CONTRACT AT MARKET
ENDIF// Conditions to exit long positions
c3 = close [0] < avg169IF c3 THEN
SELL AT MARKET
ENDIF// Conditions to enter short positions
EMA20 = ExponentialAverage[20](close)
EMA50 = ExponentialAverage[50](close)
avg169 = Average [169]c4 = EMA20 CROSSES UNDER EMA50
c5 = close [0] < close [1]IF c4 AND c5 THEN
SELL 1 CONTRACT AT MARKET
ENDIF// Conditions to exit short positions
c6 = close > avg169IF c6 THEN
SELL AT MARKET
ENDIF10/04/2022 at 3:34 PM #201911You have to change the instruction to enter and exit a SHORT trade:
- BUY enters a Long trade
- SELL exits a Long trade
- SELLSHORT enters a Short trade
- EXITSHORT exits a Short trade
1 user thanked author for this post.
10/04/2022 at 4:50 PM #201919First System Working12345678910111213141516171819202122232425262728293031323334353637383940// Definition of code parametersDEFPARAM CumulateOrders = False // Cumulating positions deactivated// Conditions to enter long positionsEMA20 = ExponentialAverage[20](close)EMA50 = ExponentialAverage[50](close)avg169 = Average[169](close)c1 = EMA20 CROSSES OVER EMA50c2 = close[0] > close[1]IF c1 AND c2 THENBuy 1 CONTRACT AT MARKETENDIF// Conditions to exit long positionsc3 = close[0] < avg169IF c3 THENSell AT MARKETENDIF// Conditions to enter short positionsEMA20 = ExponentialAverage[20](close)EMA50 = ExponentialAverage[50](close)avg169 = Average [169]c4 = EMA20 CROSSES UNDER EMA50c5 = close[0] < close[1]IF c4 AND c5 THENSellShort 1 CONTRACT AT MARKETENDIF// Conditions to exit short positionsc6 = close > avg169IF c6 THENExitShort AT MARKETENDIF1 user thanked author for this post.
10/04/2022 at 5:10 PM #201922Thanks you are a champ.
Please let me know if my ‘stupid’ questions annoy you. But this is a lot of fun trying to get my ideas into a script.
Appreciate your help! Absolutely fantastic.
Ciao
2 users thanked author for this post.
10/04/2022 at 6:25 PM #20192610/05/2022 at 9:27 AM #201931Thank you Roberto.
I just changed it slightly as we never view anyone as a fool for asking questions.
Ask a question, you may feel like a fool for a day.
Don’t ask a question, you may be a fool for life!?
4 users thanked author for this post.
10/05/2022 at 10:00 PM #201965Roberto
Here we go again!
I am trying to get the code to open the candle right after the crossing, which it doesn’t do right now, see picture below. I tried to specify the candle which should trigger the entry, however now the system it returns an error message.
// Conditions to enter long positions
EMA20 = ExponentialAverage [20]
EMA50 = ExponentialAverage [50]IF EMA20 CROSSES OVER EMA50 THEN
LongCrossingPrice = closeIF open [0] > close [1] THEN
BUY 0.5 CONTRACT AT MARKET
ENDIFIF close [0] < EMA50 THEN
SELL 0.5 CONTRACT AT MARKET
ENDIF// Conditions to enter short positions
EMA20 = ExponentialAverage [20]
EMA50 = ExponentialAverage [50]IF EMA20 CROSSES UNDER EMA50 THEN
ShortCrossingPrice = closeIF open < close [1] THEN
SELLSHORT 0.5 CONTRACT AT MARKET
ENDIFIF close [0] > EMA50 THEN
EXITSHORT 0.5 CONTRACT AT MARKET
ENDIFwhere have I gone wrong? Appreciate you pointing me in the right direction. 😉
10/06/2022 at 9:25 AM #201979Re above … no picture attached (as you said).
Does below answer your question?
Code is read at the end of each bar and entries / exits etc occurs at the begginning of the next bar (after code is read).
Next bar open – and thus entry / exit – is only a few milliseconds after previous bar close.
I believe all trading platform work same as above.
1 user thanked author for this post.
10/06/2022 at 9:50 AM #201983Not really because I don’t see where my mistake in the code is.
I thought I followed the structure of codes, thanks for pointing out the error
-
AuthorPosts
Find exclusive trading pro-tools on