Do until function
Forums › ProRealTime English forum › ProBuilder support › Do until function
- This topic has 8 replies, 3 voices, and was last updated 5 years ago by
Nicolas.
-
-
06/14/2019 at 1:31 PM #100655
Hi,
I’ve been checking for a setup in my chart, and color the background once it happens. It looks like this :
1234567891011121314//LALA = ((RSIkort < 15 OR RSIkort[1] < 15 OR RSIkort[2] < 15) AND (dss < 25) AND (Slow > 0) AND (Quick < 0))//SASA = ((RSIkort > 85 OR RSIkort[1] > 85 OR RSIkort[2] > 85) AND (dss > 85) AND (Slow < 0) AND (Quick > 0))if LA thenBACKGROUNDCOLOR(6,229,20) //greenELSIF SA thenBACKGROUNDCOLOR(255,0,0) //redELSEBACKGROUNDCOLOR(218,229,255) //standard backgroundcolorENDIFSo if LA or SA = true, the background color switch to red or green and if LA or SA = false, it switch back to the standard back groundcolor. This works as expected.
The question I have is :
Once LA or SA is true, i also want to check for another condition, but i don’t no how to build it.
Something like this
LA = A and B and C and D
If LA then
backgroundcolor (green) until (A or B or Z)
So once LA is true and the background is changed to green, i want to check for also other conditions, so if one of these extra conditions is false, i need to flip the background again to the standard color.
Can someone advice me here. Many thanks.
06/14/2019 at 1:59 PM #100657>> For clarity of messages on ProRealCode’s forums, please use the “insert code PRT” button to separate the text of the code part! Thank you! <<
06/14/2019 at 2:03 PM #100658You can add, ar line 3, CondA = …..
then, at line 8 IF LA AND CondA….
06/14/2019 at 2:15 PM #100659Thank you for your feedback.
But if i adjusted like that then the background ONLY will change when BOTH conditions are true (LA and CondA).
I want that the background changes with LA = true and stays green until one of the conditions in CondA fails.
06/14/2019 at 2:26 PM #10066206/14/2019 at 3:56 PM #1006781234567891011121314151617//LALA = ((RSIkort < 15 OR RSIkort[1] < 15 OR RSIkort[2] < 15) AND (dss < 25) AND (Slow > 0) AND (Quick < 0))CondLA = ((Slow < 0) or (dss > 85) or (RSIkort > 85 OR RSIkort[1] > 85 OR RSIkort[2] > 85) or (high < exponentialAverage[47]))If LA Thenwhile CondLA Do // Set background greenR = 153G = 210B = 77ELSIF // revert to standard backgroundR = 218G = 229B = 255ENDIF//Background Color Intraswing setupBACKGROUNDCOLOR (R,G,B)Something like this :
If the conditions of LA are true, the background will be changed to green, until one of the conditions of CondLA are met, then the background will revert to the standard background.
Only the syntax is wrong 🙁
06/14/2019 at 4:12 PM #100681WEND is missing.
The last line of an indicator must be RETURN.
06/14/2019 at 7:25 PM #10069012345678910111213141516171819//LALA = ((RSIkort < 15 OR RSIkort[1] < 15 OR RSIkort[2] < 15) AND (dss < 25) AND (Slow > 0) AND (Quick < 0))CondLA = ((Slow < 0) or (dss > 85) or (RSIkort > 85 OR RSIkort[1] > 85 OR RSIkort[2] > 85) or (high < exponentialAverage[47]))If LA Then // maak achtergrond groenR = 153G = 210B = 77while CondLA Do // standaard achtergrondR = 218G = 229B = 255WENDENDIF//Background Color Intraswing setupBACKGROUNDCOLOR (R,G,B)return dss as "DSlang", dsk as "DSkort", RSIkort as "RSIkort"So if All the conditions (RSI, DSS, Slow, Quick) of “LA” are true, the background will be set to green
Until 1/4 (Slow, DSS, RSI, MA47) conditions of “CondLA” will be set to true, the loop will be entered and revert the background to the standard color.
But what about the loop ? after the background is reverted to the standard color, the loop will never exit until all the conditions are false (Slow, DSS, RSI, MA47) again.
I just want to revert to standard background if 1/4 conditions is true and then leave the loop. Any ideas ?
06/15/2019 at 3:25 PM #100755Sorry i’m late in the discussion, but why not simply just do that: (not tested)
123456789101112131415161718192021//LALA = ((RSIkort < 15 OR RSIkort[1] < 15 OR RSIkort[2] < 15) AND (dss < 25) AND (Slow > 0) AND (Quick < 0))CondLA = ((Slow < 0) or (dss > 85) or (RSIkort > 85 OR RSIkort[1] > 85 OR RSIkort[2] > 85) or (high < exponentialAverage[47]))if CondLA then // standaard achtergrondR = 218G = 229B = 255endifIf LA Then // maak achtergrond groenR = 153G = 210B = 77ENDIF//Background Color Intraswing setupBACKGROUNDCOLOR (R,G,B)return dss as "DSlang", dsk as "DSkort", RSIkort as "RSIkort" -
AuthorPosts
Find exclusive trading pro-tools on