Funzione per operare giorni e mesi
Forums › ProRealTime forum Italiano › Supporto ProOrder › Funzione per operare giorni e mesi
- This topic has 8 replies, 4 voices, and was last updated 1 month ago by
robertogozzi.
-
-
07/24/2024 at 6:35 AM #235698
Ciao Roberto, ho trovato questo codice da te fatto per poter operare e decidere quali giorni e mese utilizzare.
Mi chiedevo se fosse possibile il mese dividerlo in due.
Dal 1 al 15 e dal 16 a fine mese.
Ti ringrazio
Paolo
123456789101112131415161718192021222324252627ONCE startT = 000000ONCE endT = 240000TimeRef = OpenTimeDayRef = OpenDayOfWeekMonthRef = OpenMonthtd0 = 1 AND DayRef = 0 AND TimeRef >= startT AND TimeRef <= endTtd1 = 1 AND DayRef = 1 AND TimeRef >= startT AND TimeRef <= endTtd2 = 1 AND DayRef = 2 AND TimeRef >= startT AND TimeRef <= endTtd3 = 1 AND DayRef = 3 AND TimeRef >= startT AND TimeRef <= endTtd4 = 1 AND DayRef = 4 AND TimeRef >= startT AND TimeRef <= endTtd5 = 1 AND DayRef = 5 AND TimeRef >= startT AND TimeRef <= endTtd6 = 1 AND DayRef = 6 AND TimeRef >= startT AND TimeRef <= endTtdCond = td0 OR td1 OR td2 OR td3 OR td4 OR td5 OR td6m1 = 1 AND MonthRef = 1m2 = 1 AND MonthRef = 2m3 = 1 AND MonthRef = 3m4 = 1 AND MonthRef = 4m5 = 1 AND MonthRef = 5m6 = 1 AND MonthRef = 6m7 = 1 AND MonthRef = 7m8 = 1 AND MonthRef = 8m9 = 1 AND MonthRef = 9m10 = 1 AND MonthRef = 10m11 = 1 AND MonthRef = 11m12 = 1 AND MonthRef = 12mCond = m1 OR m2 OR m3 OR m4 OR m5 OR m6 OR m7 OR m8 OR m9 OR m10 OR m11 OR m12tdmCond = tdCond AND mCond07/24/2024 at 7:45 AM #235701Ciao, puoi aggiungere questo codice al tuo:
123456DayOfMonthRef = OpenDayfirstHalfOfMonth = DayOfMonthRef >= 1 AND DayOfMonthRef <= 15secondHalfOfMonth = DayOfMonthRef >= 16 AND DayOfMonthRef <= 31tdmCondFirstHalf = tdCond AND mCond AND firstHalfOfMonthtdmCondSecondHalf = tdCond AND mCond AND secondHalfOfMonth07/24/2024 at 8:01 AM #23570307/24/2024 at 8:11 AM #23570407/24/2024 at 11:36 AM #23571007/24/2024 at 12:09 PM #235715questo è un esempio, ma non riesco a farlo funzionare.
DEFPARAM CumulateOrders = False
indicator1 = Average[100](close)
c1 = (close > indicator1)
DayOfMonthRef = OpenDay
firstHalfOfMonth = DayOfMonthRef >= 1 AND DayOfMonthRef <= 15
secondHalfOfMonth = DayOfMonthRef >= 16 AND DayOfMonthRef <= 31tdmCondFirstHalf = tdCond AND mCond AND firstHalfOfMonth
tdmCondSecondHalf = tdCond AND mCond AND secondHalfOfMonth
ONCE startT = 000000
ONCE endT = 240000
TimeRef = OpenTime
DayRef = OpenDayOfWeek
MonthRef = OpenMonth
td0 = 1 AND DayRef = 0 AND TimeRef >= startT AND TimeRef <= endT
td1 = 1 AND DayRef = 1 AND TimeRef >= startT AND TimeRef <= endT
td2 = 1 AND DayRef = 2 AND TimeRef >= startT AND TimeRef <= endT
td3 = 1 AND DayRef = 3 AND TimeRef >= startT AND TimeRef <= endT
td4 = 1 AND DayRef = 4 AND TimeRef >= startT AND TimeRef <= endT
td5 = 1 AND DayRef = 5 AND TimeRef >= startT AND TimeRef <= endT
td6 = 1 AND DayRef = 6 AND TimeRef >= startT AND TimeRef <= endT
tdCond = td0 OR td1 OR td2 OR td3 OR td4 OR td5 OR td6
m1 = 1 AND MonthRef = 1
m2 = 0 AND MonthRef = 2
m3 = 1 AND MonthRef = 3
m4 = 1 AND MonthRef = 4
m5 = 1 AND MonthRef = 5
m6 = 0 AND MonthRef = 6
m7 = 1 AND MonthRef = 7
m8 = 1 AND MonthRef = 8
m9 = 0 AND MonthRef = 9
m10 = 1 AND MonthRef = 10
m11 = 1 AND MonthRef = 11
m12 = 1 AND MonthRef = 12
mCond = m1 OR m2 OR m3 OR m4 OR m5 OR m6 OR m7 OR m8 OR m9 OR m10 OR m11 OR m12
tdmCond = tdCond AND mCond
IF c1 and tdmCond and tdmCondFirstHalf and tdmCondSecondHalf THEN
BUY 1 CONTRACT AT MARKET
ENDIFSET STOP %LOSS 1
SET TARGET %PROFIT 0.7507/24/2024 at 12:17 PM #23571607/24/2024 at 12:25 PM #23571707/24/2024 at 1:30 PM #235719Perché le due condizioni non possono entrare a mercato, si escludono a vicenda, altrimenti che senso ha avere suddiviso le quindicine, se va bene qualunque giorno?
1IF c1 and tdmCond and tdmCondFirstHalf and tdmCondSecondHalf THEN1 user thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on