Need help on a script that copies objests from chart A to chart B to do the opposite at the same time

 

Thanks everyone, this problem was solved.

************************

Hi.

By using this script, you can copy objests from chart A to chart B just fine, but you can't make it copy from chart B to chart A at the same time.

How to copy:

1 Set extern bool bMaster = false for chart A, which you want to copy objects from.

2 Set extern bool bMaster = true for chart B, which you want to copy objects to.

By doing below, you can do just the opposite.

3 Set extern bool cbMaster = true, for chart A.

4 Set extern bool cbMaster =false, for chart B.

But if you do 1-4 at the same time, nothing gets copied. I don't know why. Maybe it has something to do with the nature of golbal variables? I'm a newbie and can't figure out why.

Can you make it copy from and to at the same time?

Thank you.

 
Just guess, because so much code,
Replace
void start()
{
    while (IsStopped() == false)
   {
if (bMaster)//true‚И‚з
{
  updateVars();
} 
if (cbMaster)//true‚И‚з
{
  cupdateVars();
} 
else
{
  updateObjects();
  cupdateObjects();
    }

double t = MathMax(tUpdate * 1000, 100);
Sleep(t);
    }
}
to
void start()
{
    while (IsStopped() == false)
   {
if (bMaster)//true‚И‚з
{
  updateVars();
} 
         else updateObjects();
if (cbMaster)//true‚И‚з
{
  cupdateVars();
} 
else
{
  
  cupdateObjects();
    }

double t = MathMax(tUpdate * 1000, 100);
Sleep(t);
    }
}
 
Roger wrote >>
Just guess, because so much code,
Replace
to

Thank you Roger, I did what you suggested. It enabled bMaster to copy, but it couldn't do the same for cbMaster.

I have also tried below, but same thing.

If I could copy objects to and from a chart at once, a lot of time and work will be saved.

Any suggestions as to what should be changed, or,is there any script or EA that does it?

void start()

{
while (IsStopped() == false)
{
if (bMaster)
{
updateVars();
}
if (!bMaster)
{
updateObjects();
}

if (cbMaster)
{
cupdateVars();
}
if(!cbMaster)
{
cupdateObjects();
}

double t = MathMax(tUpdate * 1000, 100);
Sleep(t);
}
}

Reason: