Coding help

Post Reply
User avatar
crashout
Trader
Posts: 75
Joined: Fri Dec 23, 2011 4:17 pm
Location: In the trading room !

Coding help

Post by crashout »

Hello all,

I made a step ma expert with the help of steve's shell (vey brilliant work).

I use this :

Code: Select all

int trendCurr = iCustom(s_symbol,StepMaTimeFrame,"Stepma",Length,Kv,StepSize,MA_Mode,Advance,Percentage,UpDownShift,HighLow,ColorMode,5,StepMaBarToTest  );
int trendPrev = iCustom(s_symbol,StepMaTimeFrame,"Stepma",Length,Kv,StepSize,MA_Mode,Advance,Percentage,UpDownShift,HighLow,ColorMode,5,StepMaBarToTest+1);
     
     if (trendCurr > 0 && trendPrev < 0) SendLong = true;
    
     
     if (trendCurr < 0 && trendPrev > 0) SendShort = true;
Now i need help, what sort of code can i use, if i want to trade the pullbacks of price on the stepma ?

If the price touch the stepma it enters in the way of the stepma color.

Thanks !
Lowphat
Trader
Posts: 121
Joined: Fri Jun 27, 2014 12:20 am

Coding help

Post by Lowphat »

i remember in late 2005 early 2006 when he wrote 6.2 stepma i asked Igorad if there was an easy way to add up/dn percentage deviation to it(adding 2 on chart to make channels) and a few days later he added percent to 6.3.
you may want color mode set to "1" otherwise you would only have one color and you mention setting it in the direction of the color. if the above is true then you will be working with 2 buffers not one. I'm guessing

SetIndexBuffer(1,UpBuffer);
SetIndexBuffer(2,DnBuffer);

so i would imagine 5,StepMaBarToTest ); would be actually be
... ,1,StepMaBarToTest ); // up color
... ,2,StepMaBarToTest ); // dn color

and previous bar can be

... ,1,StepMaBarToTest +1 ); // up color previous
... ,2,StepMaBarToTest +1 ); // dn color previous

so in theory you might could
if price >= current_UPbuffer
or maybe
if price < previous_UPbuffer && price > current_UPbuffer
I really don't know for sure as I haven't messed with it in a long time.
User avatar
crashout
Trader
Posts: 75
Joined: Fri Dec 23, 2011 4:17 pm
Location: In the trading room !

Coding help

Post by crashout »

Thank you Lowphat i will try that.
User avatar
crashout
Trader
Posts: 75
Joined: Fri Dec 23, 2011 4:17 pm
Location: In the trading room !

Coding help

Post by crashout »

Thanks Lowphat, your logic is working :!!:

Now i just need a litlle help :

If i want to wait a candle close, can i use Close[0] like this :

Code: Select all

if (Close[0]<current_UPbuffer) SendLong = true;

if (Close[0]>current_Downbuffer) SendShort = true;
Lowphat
Trader
Posts: 121
Joined: Fri Jun 27, 2014 12:20 am

Coding help

Post by Lowphat »

you can probably use Close[1] to confirm a closed bar. you will want to stay away from using Close[0] as it would be the same thing as using Bid. bar 0 really doesn't close because a new 0 bar forms the same time one closes. so perhaps
Close[1] < Previous_UP_Buffer or current if you wanted to confirm bar close before setting your bool
User avatar
crashout
Trader
Posts: 75
Joined: Fri Dec 23, 2011 4:17 pm
Location: In the trading room !

Coding help

Post by crashout »

After days of work, it finally works.

Thank you Lowphat !

I have to add a buffer because of bad coding indicator, but it works !

:cheer:
Lowphat
Trader
Posts: 121
Joined: Fri Jun 27, 2014 12:20 am

Coding help

Post by Lowphat »

i'm glad you got it working the way you wanted :smile:
thegatan
Posts: 1
Joined: Thu Oct 16, 2014 4:44 am

Coding help

Post by thegatan »

hello friend,
i need help for some modification from standart bollinger band with detail like picture:
the value is from london open or could be set time, and display from any of pair,
only print the value on london open/set time server, if could print yesterday value to beside
BB TIME.png
You do not have the required permissions to view the files attached to this post.
Post Reply

Return to “Coders Hangout”