Buy a long every week if the high is higher than the last high
Forums › ProRealTime English forum › ProOrder support › Buy a long every week if the high is higher than the last high
- This topic has 6 replies, 2 voices, and was last updated 10 months ago by robertogozzi.
-
-
02/19/2024 at 9:44 AM #228381
Hi,
if a daily high is higher than the high of the last week it is a buy. The position should be closed after 6 days, but this don’t happen, i dont know why?
1234567891011121314151617181920212223242526272829303132333435363738394041Timeframe (1 WeeK )MyMHigh = High[1]MyMLow = Low[1]TIMEFRAME(1 Day)Long = High CROSSES OVER myMHighShort = Low CROSSES UNDER MyMLow//Prüfe, ob wir uns in einer neuen Woche befinden und setzen kannKaufen zurück falls jaIf DayOfWeek = 1 Then // Angenommen Montag ist der erste HandelstagkannKaufen1 = 1 // Erlaube einen neuen Kauf für diese WocheEndIf//Prüfen ob in der zweiten Woche gekauft werden kannIf DayOfWeek = 1 AND kannKaufen1 =0 THEN // Angenommen Montag ist der erste HandelstagkannKaufen2 = 1 // Erlaube einen neuen Kauf für die zweite WocheEndIf// KauflogikIf kannKaufen1=1 And long ThenBuy 1 contract at marketLetzteKaufDatum = BarIndex // Speichere das Datum des KaufskannKaufen1=0 // Verhindere weitere Käufe in dieser WocheENDIFIf kannKaufen2=1 And long ThenBuy 1 contract at marketLetzteKaufDatum2 = BarIndex // Speichere das Datum des KaufskannKaufen2=0 // Verhindere weitere Käufe in dieser WocheENDIF// Verkaufslogik - Verkaufe Kontrakt nach 22 TagenIf BarIndex - LetzteKaufDatum = 6 ThenSell 1 contract at market//LetzteKaufDatum = 0 // Setze LetzteKaufDatum zurück nach dem VerkaufEndIfIf BarIndex - LetzteKaufDatum2 = 6 ThenSell 1 contract at market//LetzteKaufDatum2 = 0 // Setze LetzteKaufDatum zurück nach dem VerkaufEndIf02/19/2024 at 4:15 PM #228406Add these lines after line 17:
1234If OnMarket THENkannKaufen1 = 0kannKaufen2 = 0endif1 user thanked author for this post.
02/20/2024 at 7:56 AM #228424Thanks, but this didnt solve the problem. With this lines ther will be only one contract in the market, but the buy condition “higher than the high the week before” is every week possible. The problem seems to be that there is no sell if the buy condition is reached.
For example:
1th Day buy condition –> buy a contract at market
7 th Day buy condition for the second week –> buy a contract at market
7th Day sell condition for the first contract “sell after 6 days” reached, but there isnt a sell, the sell is not executed
02/20/2024 at 5:53 PM #228472PRT has so many limitations, I think maybe it’s better not to do such things in PRT.
02/20/2024 at 7:04 PM #228477Why do you enter LONG twice?
02/21/2024 at 3:18 PM #228504Because the entry condition can be reached every week.
02/21/2024 at 6:53 PM #228527You are NOT checking “higher than the high the week before”. You are checking CROSSOVERs, instead, why?
-
AuthorPosts
Find exclusive trading pro-tools on