Jump to content

Welcome to the new Traders Laboratory! Please bear with us as we finish the migration over the next few days. If you find any issues, want to leave feedback, get in touch with us, or offer suggestions please post to the Support forum here.

andypap

Members
  • Content Count

    52
  • Joined

  • Last visited

Everything posted by andypap

  1. hi i dont know if you still offer help. i am intresed for a trendline indicator to explain better the code should not have Tl type functions and will plot values on everybar.it should resemble a trendline even if its not as exact as a manually drown trenline... my own best shot at this was to take a long term average that resembels a trendline and then if the close > than the average i would store the highest for barcounter above the average, take the difference (highest(h,barcounterabov e) - average ) and add that number to all bars that h < highest(h,barcounterabove ) to the average value.. the result is a channel like projection at the high that keeps the average slope untill a new high is found.. the problem with this code is that the average is not conecting the low swings like a trendline would and at the first x bars after a new up trend is develloping the high is breaking every other bar almost regards
  2. i think that its very nice of you to answer to all this questions everyone in this site i assume is greatfull the various posts from everyone are at least usefull for novice programmers like me... one cant find himself in the middle of his journey if he doesnot start from somewhere.. and i suppose that all pikers like me start from the sameplace more or less.. what i have remarked previously is just my personal stand after i have wondered for a long time in indicator land even now i cant really tell if my work is productive or i still look at smoke and mirrors.. but i am at the last stretch...if i fail afetr all this research i will quit autommated and turn to semi autommated(alerts from marketscanner).. the nastiest part is the limitations of the reserved words of easy language..partcicullary for strategies you only learn as you go by that you will pay a heavy toll for the fast learning curve regards
  3. hi does anybody has and wish to share or knows where to find a trendline like indicator ? to explain better the code should not have Tl type functions and will plot values on everybar.it should resemble a trendline even if its not as exact as a manually drown trenline... my own best shot at this was to take a long term average that resembels a trendline and then if the close > than the average i would store the highest for barcounter above the average, take the difference (highest(h,barcounterabove) - average ) and add that number to all bars that h < highest(h,barcounterabove) to the average value.. the result is a channel like projection that keeps the average slope untill a new high is found.. regards
  4. thanks i have adjusted the maxbarsback settings so the indicator and strategy got sunchronized and they print the same values... at the far left of the chart(beggining) the values are all over the place though what is the typical way in easy langauge for the variables not to return any values untill ALL the variables are calculated well ? i am only declaring them vars: value1(0),value2(0) ; should i also initialize them? ( i initialize only summation variables so far) as for the code itself to be honest i have waisted so much time on useless indicators that i dont want to post anything that it is not finished and has some statistical bias.. i have a coupple of strategies that just survive and make a little so far... i am only working in statisticks and with concepts that derrive from the maket own flow... in the beggining i was trying to create " indicators" like take the fisher transormation that is quite smooth and has little lag and apply the smoothing part of the code to an oscillator that preceeds price etc ..... although the results where very impresive to the eye ( i could post very impressive pics of the indicator in action ) it wouldnt stand a chance in the market as i know now. why waste anybody time with smoke and mirrors ? thanks again and regards
  5. hi is there a standard way to inisialize a variable that requires a lot of bars to calculate it self not to hold any values before calculating itself correctly? regards
  6. i am facing a situation where a strategy and an indicator based exactly on the same code ( thoroughly checked ) are calculating different results for the same variables... i have printed those results on a text files and the funny thing is that even within the strategy code the results are different for the same variables if i change the maxbarsback settings from the strategie/properties tab... the indicator is ploting the correct variables values though ( confirmed manually with the calculator ) even funnier from the middle of the chart ( 7 months of 1 min data ) the indicator and strategy sunchronize perfectly /////indicator print ///// correct values 1.00 3.77 2.55 2.30 1090819.00date 931.00time 8886.00 barnumber ///// strategy print ///// -1.00 1.44 1.12 1.00 1090819.00date 931.00time 1701.00 barnumber i dont even understand the nature of this problem . i suspect it has to do with the variables off the code that take a lot of bars to calculate... any i deas about how i can resolve this will be much appresiated regards
  7. thanks a lot flyingdutcmen that loop did the job perfectly!!!!!!!!! many many thanks...
  8. the counter is a critical part of this code and its purpose is to keep stastisticks between " key reversals"... has nothing to do with the array other that every " key reversal" occurance the counter is 1.. the array needs to hold the " closing" prices of the last N(20 for example) "key reversal" occurrances from key reversal to next keyreversal .... my problem is not declaring the size of the array but what kind of loop (the exact syntax) needed to populate the array properly. I HAVE THOUGHT TO USE THE COUNTER because every key reversal the counter is 1 and there is a "length" between key reversals to use in the loop.. have in mind that the counter between key reversals has a variable length . with direction form current to previous lets suppose once a new key reversal shows the counter is 1, 20 ,33, 217 etc... right then the array should be populated array[1] = current close array[2] = c[20] = c of previous key reversal array[3] = c[20 + 33] = c of 2 key reversals back array[4] = c{20 + 33 + 217] = c of 3 key reversals back etc untill N array elements then as new bars come and the current counter is incrementing those values will stay as they are untill next key reversal where the counter resets to 1 again and at that point the array will be repopulate in the same manner... array [1] will be new key reversal and all other elements will shift one row down till N... IF there is a way to do the same thing without using a counter then i will be happy to learn how
  9. thanks frank i will appreciate much if you cross something like this to let me know.. i have tried so far a few different loops but i couldnot do it...
  10. thanks for this answer but what about arr[2] etc... also 20 was an example the array elements should be contolled via length input.. regards
  11. suppose that the condition that sets the counter is a bullish key reversal.. and the array holds 20 elements.. every time a bullish key reversal happens the counter is 1 and incrementing by 1 for all the bars beteen key reversals.. when the counter resets to 1 the array is populated with the closing values of the last 20 keyreversals in the chart and will keep those values unchanged unill a new bullish key reversal appears ant the counter resets to 1 again.. i hope that this will be clear enough.. many regards
  12. hi guys does anybody know how to create a back wards day counter in minute charts that will count starting from current day equals N down to 1 ? if N is 5 lets say current day on chart will be 5 previous day will be 4 etc down to 1 and then the loop will restart 6 day previous to current day at 5 again.. note that at the beginning of each trading day the counter should be recalculated to 5 the following code is counting forward from 1 to 5 and current day increments by one each trading day untill 5 is reached and then resets to 1.. i dont know if a backwards counter is possible though.. if date > date[1] then datecnt = datecnt + 1; if datecnt > 5 then datecnt = 1 ; regards
  13. hi guys i have a counter based on a condition and what i would like to know is how to create an one dimentional array that will allign all the closing values when the counter value is 1.. (the counter value is one everytime the condition occurs). the chart displays the counter values... my question has to do with the kind of loop required to populate such an array.. so if the counter is mycounter and the array myarr i have tried for j = 1 to mycounter begin myarr[j] = c[j]; end; also if mycounter = 1 then for j = 1 to mycounter begin myarr[j] = c[j]; end; but it didnot work... any help on this will be much appreciated.
  14. Inputs: Price ©,Period (30); vars : val(0),return(0); if BarType >= 2 then val= volume else val = ticks; if 100 - 100 / (1 + Average (iff (Momentum (Price, 1) > 0, Momentum (Price, 1) * val, 0), Period) / Average (iff (Momentum (Price, 1) < 0, -1 * Momentum (Price, 1) * val, 0), Period)) <> 0 then Return = 100 - 100 / (1 + Average (iff (Momentum (Price, 1) > 0, Momentum (Price, 1) * val, 0), Period) / Average (iff (Momentum (Price, 1) < 0, -1 * Momentum (Price, 1) * val, 0), Period)) ; if 100 - 100 / (1 + Average (iff (Momentum (Price, 1) > 0, Momentum (Price, 1) * val, 0), Period) / Average (iff (Momentum (Price, 1) < 0, -1 * Momentum (Price, 1) * val, 0), Period)) = 0 then Return = .0001; plot1(return); the code above is the original indicator..gives floating point errors when period<30.. i try to simplify the code by the following lines vars :prval(0),plusval(0); prval = c-c[1]; if prval > 0 then plusval = prval*val else plusval = 0; value1 = iff (Momentum (Price, 1) > 0, momentum(price,1)*val, 0); value2 = average(value1,period); value3 = Average (iff (Momentum (Price, 1) > 0, momentum(price,1)*val, 0), Period); plusval and value1 are exactly the same so do their averages value2 and the eqivelent average of plusval.. value3 plots slightly different values.. but these is the segment of the original code.. so i was wondering why the average of the iff value(value2) is different than value3.. i was thinking maybe there is something between these two statments worth exploring thanks for your patience regards
  15. thanks in advance for the reply.. you mean this average summation is the following momentum(price,1)*val + momentum(price,1)[1] *val to period instead momentum(price,1)*val + momentum(price,1)[1] *val[1] to period .. maybe i havn't understood though. regards
  16. can anybody explain why this two averages have different values? regards this is the code: Inputs: Price ©,Period (30); vars : val(0); if BarType >= 2 then val= volume else val = ticks; value1 = iff (Momentum (Price, 1) > 0, momentum(price,1)*val, 0.0001); value2 = average(value1,period); value3 = Average (iff (Momentum (Price, 1) > 0, momentum(price,1)*val, 0.0001), Period); plot1(value2); plot2(value3);
  17. thanks ehorn but this looks like c is it possible to writte these lines in easy language
  18. hi guys anyone knows how to take evey n elements of a one dimentional array and fille another array.. lets say n is 3. so element 0,3,6,9,12 etc of the original array will fill the new array as element 0,1,2,3,4 etc. thanks in advance
  19. here is a pic where the condition if current contracts < maxcontracts then value1 = high; if c > h + 0.50 then sell current contracts -1 sells before the position is scaled out at a time where current contracts = max contracts "test" sells 1 contract just to mark where current contracts < max contracts by this condition if barsinceentry > n then sell "test"
  20. this reserved word is specified as a completely closed position..thats why i didnot even took a shot at this.. i also have tried to bundle this with the conditional statment that triggered the first exit.. if conditions then value1 = high; the problem is "conditions" kept occuring after the first exit changing value1 each time they occured.. hypothetically speaking if someone sets a first target in a strategy scales out 1/2 of the position there and then wants to sell 1/2 more on a fixed price level above the first exit its a dead end because there is no way to use the strategy position reserved words in a conditional statment.. thats really funny for a langauge develloping over 10 years..
  21. well if that is followed by this : then sell n contracts this bar close i can see in my 1 min chart that 10 bars after the entry there is a sell for n my point here though is whether one can mark the high/low value of the bar of the first exit (scaling out of a position). i thought that a way to do so is by using currentcontracts<maxcontracts and it didnot work..then i turn to barssinceentry and entrytime only to realize that they work fine only if followed by a sell/buyto cover command; do you know an alternate way or am i making a mistake somewhere;
  22. actually the reserved word is entrytime... it marks the time a position was entered.. entrytime(0) is last openposition,entrytime(1) is one position prior etc. if you declare a var value1 = entrytime(0) it will return 1000 if last position was entered at 10.00 am.. notice that it works fine as long as it is attached with a sell order after a long position was entered. it wont work though in a conditional statment like if time > entrytime + 10 then //10 bars after entry in one min chart// value1 = high;
  23. hi guys i am dealing with a particular problem in MC, i am trying to get the high value of the bar that a long position in a strategy is scaled out... if barsinceentry > 5 then sell n contract next bar market if currentcontracts < maxcontracts then value1 = high; //and then // if high > value1 + .30 sell n contracts next bar market; // where n = position total /2 // this doesnt work neither the reserved word "time since entry" if time > timesinceentry + 10 then value1 = high; both thought if attached to a sell order they work properly. if time > timesinceentry + 10 or currentcontracts < maxcontracts then sell x next bar market; the question here is how do i mark the high of the bar that a long position got scaled out in a strategy.. what was the code that initiated the first sell is no important it can be anything like if h > highest(high,30)[1] then sell totalcontracts/2 next bar market; how can i reference the bar that this activity just took place as a benchmark for future activity is my question if anyone knows the answer.. thanks in advance..i feel that a technique like that most likely will be usefull for some people in this forum.
  24. thanks blowfish.. the nested loop gave me a solution. first i did a dynamic array and set maxlen to 390 via an input:seieslen(390); then i used an if condition before the nested loop: if .....then for n=0 to serieslen-1 begin myarray[n]=close[n]; for m=o to serieslen-1 begin myarray[m]=myarray[n][m]; end;end; plot1(myarray[serieslen-1]; that did the job of storing the values every 390 bars starting from current bar backwards, if applyied to 1 min chart it gives you the close of last 1min bar of day and the first 389 have a value of zero.so if you sum the 390 bars what you get is the closing value of the last bar.if you sum 5*390 bars you have a 5 day mov average builded from 1 min bars. so the indicator is working ok. i am thinking though that this doesnt answer my second question of a more general form.. is it possible and how in EL to access the values of a row in a two dimension array of 7 columns lets say ( 0 to 6) in a manner as if they where the elements of a column? i will try to make this visible if the row is 10 of array:myarray[10,6]; then imagine these row elements accumulated as if they look like a column array[10,0] array[10,1] array[10,2] array[10,3] down to array[10,6] thanks again
  25. If someone in the forum knows how to do this please writte the actual code lines...
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.