sorry
Iused supertrend indicator in chart...
today I was long whit indicator....but now with same setting IT IS SHORT....
How is possible?
why?
I mean.....in real time it was long ,but at end day ,today, in backtest it is shortsorry
Iused supertrend indicator in chart...
today I was long whit indicator....but now with same setting IT IS SHORT....
How is possible?
and now Im in loss!!!
I use SUPERTREND INDICATOR,and with a Italian softwaere with same frame 1 hour,
and same setting parametres it t goes long at price 5.26
indeed in multicharts charts it goes long at 5.18!!!
the signal long of this morbning is mising,,,but I m in loss!!!
bho....
-----------------------------please
I need an answer
maybe problem is REPAINT?
Matricks what tink about?
//+------------------------------------------------------------------+
//| SuperTrend.mq4 v1.2 |
//| Copyright © 2008, Jason Robinson (jnrtrading). |
//| http://www.spreadtrade2win.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2008, Jason Robinson."
#property link "http://www.spreadtrade2win.com"
#property indicator_chart_window
#property indicator_color1 Lime
#property indicator_color2 Red
#property indicator_width1 2
#property indicator_width2 2
#property indicator_buffers 2
double TrendUp[], TrendDown[];
int changeOfTrend;
extern int Nbr_Periods = 10;
extern double Multiplier = 3.0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexBuffer(0, TrendUp);
SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, 2);
SetIndexLabel(0, "Trend Up");
SetIndexBuffer(1, TrendDown);
SetIndexStyle(1, DRAW_LINE, STYLE_SOLID, 2);
SetIndexLabel(1, "Trend Down");
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int limit, i, flag, flagh, trend[5000];
double up[5000], dn[5000], medianPrice, atr;
int counted_bars = IndicatorCounted();
//---- check for possible errors
if(counted_bars < 0) return(-1);
//---- last counted bar will be recounted
if(counted_bars > 0) counted_bars--;
limit=Bars-counted_bars;
//Print(limit);
//----
for (i = Bars; i >= 0; i--) {
TrendUp = EMPTY_VALUE;
TrendDown = EMPTY_VALUE;
atr = iATR(NULL, 0, Nbr_Periods, i);
//Print("atr: "+atr);
medianPrice = (High+Low)/2;
//Print("medianPrice: "+medianPrice);
up=medianPrice+(Multiplier*atr);
//Print("up: "+up);
dn=medianPrice-(Multiplier*atr);
//Print("dn: "+dn);
trend[i]=1;
if (Close[i]>up[i+1]) {
trend[i]=1;
if (trend[i+1] == -1) changeOfTrend = 1;
//Print("trend: "+trend[i]);
}
else if (Close[i]<dn[i+1]) {
trend[i]=-1;
if (trend[i+1] == 1) changeOfTrend = 1;
//Print("trend: "+trend[i]);
}
else if (trend[i+1]==1) {
trend[i]=1;
changeOfTrend = 0;
}
else if (trend[i+1]==-1) {
trend[i]=-1;
changeOfTrend = 0;
}
if (trend[i]<0 && trend[i+1]>0) {
flag=1;
//Print("flag: "+flag);
}
else {
flag=0;
//Print("flagh: "+flag);
}
if (trend[i]>0 && trend[i+1]<0) {
flagh=1;
//Print("flagh: "+flagh);
}
else {
flagh=0;
//Print("flagh: "+flagh);
}
if (trend[i]>0 && dn[i]<dn[i+1])
dn[i]=dn[i+1];
if (trend[i]<0 && up[i]>up[i+1])
up[i]=up[i+1];
if (flag==1)
up[i]=medianPrice+(Multiplier*atr);
if (flagh==1)
dn[i]=medianPrice-(Multiplier*atr);
//-- Draw the indicator
if (trend[i]==1) {
TrendUp[i]=dn[i];
if (changeOfTrend == 1) {
TrendUp[i+1] = TrendDown[i+1];
changeOfTrend = 0;
}
}
else if (trend[i]==-1) {
TrendDown[i]=up[i];
if (changeOfTrend == 1) {
TrendDown[i+1] = TrendUp[i+1];
changeOfTrend = 0;
}
}
}
WindowRedraw();
//----
return(0);
}
//+------------------------------------------------------------------+
someone could please this code in EL write?
to me is impssible to do
-
- Posts: 275
- Joined: Apr 22 2014
- Has thanked: 70 times
- Been thanked: 72 times
RedBerlin,
Your local and exchange time should be the same in this case. That is not your problem. If I am not mistaken, there is a Supertrend indicator for Multicharts coded and available in the multicharts download section on the bigmiketrading forum. Keep in mind that there is a one time fee to access the site.
Your local and exchange time should be the same in this case. That is not your problem. If I am not mistaken, there is a Supertrend indicator for Multicharts coded and available in the multicharts download section on the bigmiketrading forum. Keep in mind that there is a one time fee to access the site.
hiRedBerlin,
Your local and exchange time should be the same in this case. That is not your problem. If I am not mistaken, there is a Supertrend indicator for Multicharts coded and available in the multicharts download section on the bigmiketrading forum. Keep in mind that there is a one time fee to access the site.
could the reason be that I ve used "buy this bar on close"?
- Andrew MultiCharts
- Posts: 1587
- Joined: Oct 11 2011
- Has thanked: 931 times
- Been thanked: 559 times
Hello RedBerlin,I mean.....in real time it was long ,but at end day ,today, in backtest it is shortsorry
Iused supertrend indicator in chart...
today I was long whit indicator....but now with same setting IT IS SHORT....
How is possible?
and now Im in loss!!!
I use SUPERTREND INDICATOR,and with a Italian softwaere with same frame 1 hour,
and same setting parametres it t goes long at price 5.26
indeed in multicharts charts it goes long at 5.18!!!
the signal long of this morbning is mising,,,but I m in loss!!!
bho....
Please print the values calculated in the indicator to see why it shows short. You can find an example of print code here to integrate your own print statements.
Hello RedBerlin,
Please print the values calculated in the indicator to see why it shows short. You can find an example of print code here to integrate your own print statements.[/quote]
-----------------
hi Andrew
I noticed a thing very strange...
for example in italian software with same frame and same stock, the Supertrend
every hour is update and never,,,REPEAT never move during hour frame!!!
on the contrary same frame supertrend in Multicharts update price at end hours but during
hours session trading move continually ...it doesnt stop price but move up and down
!!!
I think this is not correct way and maybe this is the true problem!!!
Please print the values calculated in the indicator to see why it shows short. You can find an example of print code here to integrate your own print statements.[/quote]
-----------------
hi Andrew
I noticed a thing very strange...
for example in italian software with same frame and same stock, the Supertrend
every hour is update and never,,,REPEAT never move during hour frame!!!
on the contrary same frame supertrend in Multicharts update price at end hours but during
hours session trading move continually ...it doesnt stop price but move up and down
!!!
I think this is not correct way and maybe this is the true problem!!!
- Andrew MultiCharts
- Posts: 1587
- Joined: Oct 11 2011
- Has thanked: 931 times
- Been thanked: 559 times
To calculate on every tick in real-time:hi Andrew
I noticed a thing very strange...
for example in italian software with same frame and same stock, the Supertrend
every hour is update and never,,,REPEAT never move during hour frame!!!
on the contrary same frame supertrend in Multicharts update price at end hours but during
hours session trading move continually ...it doesnt stop price but move up and down
!!!
I think this is not correct way and maybe this is the true problem!!!
If this is an indicator, please make sure the "Update on every tick" box is checked in the settings.
If this is a signal, please make sure IOG is enabled in settings.
yes Andrew,"update on every tick is checked in the settings og indicator!!To calculate on every tick in real-time:hi Andrew
I noticed a thing very strange...
for example in italian software with same frame and same stock, the Supertrend
every hour is update and never,,,REPEAT never move during hour frame!!!
on the contrary same frame supertrend in Multicharts update price at end hours but during
hours session trading move continually ...it doesnt stop price but move up and down
!!!
I think this is not correct way and maybe this is the true problem!!!
If this is an indicator, please make sure the "Update on every tick" box is checked in the settings.
If this is a signal, please make sure IOG is enabled in settings.
but signal ?where I have to see?
however I think is better indicator check when bar is end and not every tick!!
maybe problem is this one!!!
Code: Select all
// SuperTrend indicator
inputs:
ATRLength(1.5), ATRMult(4.9), UpColor(green), DnColor(red);
vars:
ATR(0),
avg(0),
dn(0),
up(0),
trend(1),
flag(0),
flagh(0),
SuperTrend(0);
ATR = AvgTrueRange(ATRLength) * ATRMult;
avg = (high + low)/2;
up = avg + ATR;
dn = avg - ATR;
if close > up[1] then
trend = 1
else if close < dn[1] then
trend = -1;
if trend < 0 and trend[1] > 0 then flag=1 else flag=0;
if trend > 0 and trend[1] < 0 then flagh = 1 else flagh = 0;
if trend > 0 and dn < dn[1] then dn=dn[1];
if trend < 0 and up > up[1] then up=up[1];
if flag = 1 then up = avg + ATR;
if flagh = 1 then dn = avg - ATR;
if trend = 1 then SuperTrend = dn else SuperTrend = up;
Plot3(SuperTrend,"SuperTrend",iff(trend = 1, green, red));
--------------------------------------------
----------------------------------------------
Code: Select all
[LegacyColorValue = TRUE];
inputs:
ATRLength(1.5), ATRMult(4.9), UpColor(cyan), DnColor(magenta);
vars:
ATR(0),
avg(0),
dn(0),
up(0),
trend(1),
flag(0),
flagh(0),
SuperTrend(0);
ATR = AvgTrueRange(ATRLength) * ATRMult;
avg = (high + low)/2;
up = avg + ATR;
dn = avg - ATR;
if close > up[1] then
trend = 1
else if close < dn[1] then
trend = -1;
if trend < 0 and trend[1] > 0 then flag=1 else flag=0;
if trend > 0 and trend[1] < 0 then flagh = 1 else flagh = 0;
if trend > 0 and dn < dn[1] then dn=dn[1];
if trend < 0 and up > up[1] then up=up[1];
if flag = 1 then up = avg + ATR;
if flagh = 1 then dn = avg - ATR;
if trend = 1 and trend[1]< 0 Then Buy next bar at open;
if trend = -1 and trend[1]> 0 then sellshort next bar at open;
- JoshM
- Posts: 2196
- Joined: May 20 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
IOG for signals can be enabled with a setting (see here) or by enabling the `IntraBarOrderGeneration` attribute (see here).yes Andrew,"update on every tick is checked in the settings og indicator!!
but signal ?where I have to see?
however I think is better indicator check when bar is end and not every tick!!
maybe problem is this one!!!
There may be dozen of reasons why an indicator in MultiCharts performs differently than the indicator in another software program. Even if both platforms have their settings set to the same, there might still be differences in how ticks are processed and (the order of) script calculation. There might also be subtle code differences between PowerLanguage and the other platform's language that can lead to different values.I noticed a thing very strange...
for example in italian software with same frame and same stock, the Supertrend
every hour is update and never,,,REPEAT never move during hour frame!!!
on the contrary same frame supertrend in Multicharts update price at end hours but during
hours session trading move continually ...it doesnt stop price but move up and down
!!!
I think this is not correct way and maybe this is the true problem!!!
And if that Italian platform uses a different data feed, that can also account for differences.